-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_diff21.m
34 lines (34 loc) · 913 Bytes
/
test_diff21.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function e = test_diff21()
% The following code runs the test for the function diff21 and returns the
% number of tests that fail
% Author: Abhirup Das 2/14/2011
% Start off by initializing e = 0
e = 0;
fprintf('Runs the test for the function diff21, and displays the answer \nIt also checks whether the answer is the same as the value inherent in our \ntest and reports if there are any errors in our test.\nIn that case we can simply go back to our code and clarify our mistake\nHere x is the value of diff21(n) where n is the integer\n')
fprintf('Number 21')
x = diff21(21)
if x ~= 0
e = e + 1;
end
fprintf('Number 10')
x = diff21(10)
if x ~= 11
e = e + 1;
end
fprintf('Number 2')
x = diff21(2)
if x ~= 19
e = e + 1;
end
fprintf('Number 25')
x = diff21(25)
if x ~= 8
e = e + 1;
end
fprintf('Number 30')
x = diff21(30)
if x ~= 18
e = e + 1;
end
fprintf('Total Errors in test = %d\n', e)
end