-
Notifications
You must be signed in to change notification settings - Fork 0
/
functiontesters.c
55 lines (49 loc) · 1.72 KB
/
functiontesters.c
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
int isLeapYear(int);
int smallest(int, int, int);
int rectangle(int, int);
int main(void){
int rc;
rc = isLeapYear(2014);
if(rc != 0){
printf("Your isLeapYear function is not working\n");
printf("isLeapYear(2014) should have returned a false value\n");
printf("but it returned a true value\n");
}
else{
printf("isLeapYear(2014) returns correct return value\n");
}
rc = isLeapYear(2000);
if(rc == 0){
printf("Your isLeapYear function is not working\n");
printf("isLeapYear(2000) should have returned a true value\n");
printf("but it returned a false value\n");
}
else{
printf("isLeapYear(2000) returns correct return value\n");
}
rc = isLeapYear(2012);
if(rc == 0){
printf("Your isLeapYear function is not working\n");
printf("isLeapYear(2012) should have returned a true value\n");
printf("but it returned a false value\n");
}
else{
printf("isLeapYear(2012) returns correct return value\n");
}
rc = isLeapYear(1900);
if(rc != 0){
printf("Your isLeapYear function is not working\n");
printf("isLeapYear(1900) should have returned a false value\n");
printf("but it returned a true value\n");
}
else{
printf("isLeapYear(1900) returns correct return value\n");
}
printf("smallest(2,5,-1) returned %d, should return -1\n",smallest(2,5,-1));
printf("smallest(10,20,30) returned %d, should return 10\n",smallest(10,20,30));
printf("smallest(10,-5,20) returned %d, should return -5\n",smallest(10,-5,20));
printf("smallest(10,10,10) returned %d, should return 10\n",smallest(10,10,10));
printf("smallest(-12,5,-12) returned %d, should return -12\n",smallest(-12,5,-12));
return 0;
}