% testPowersOf2LeX.m   test function powersOf2LeX(x)
% P. Conrad for CISC106, sect 99, 10/07/2007

% Test function that produces a row vector of all powers of 2 <= x

%%%%%%%%%%%%%%%%%
% Run the tests %
%%%%%%%%%%%%%%%%%

% Test 1

actual = powersOf2LeX(80);
expected = [64 32 16 8 4 2 1];

if (actual == expected)
  disp('test 1 passed');
else
  disp('test 1 failed');
  expected
  actual
end
  
% Test 2

actual = powersOf2LeX(8);
expected = [8 4 2 1];

if (actual == expected)
  disp('test 2 passed');
else
  % signal that test failed, and print both expected and actual
  disp('test 2 failed');
  expected
  actual
end

% end testPowersOf2LeX.m

