-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_test.c
53 lines (45 loc) · 1.2 KB
/
main_test.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
#include "cheat.h" //<cheat.h> mas correcto
#include "funciones.h"//"funciones.h" mejor
CHEAT_TEST(decimal_to_binary_as_decimal,
cheat_assert(decimal_to_binary(10) == 1010);
cheat_assert(decimal_to_binary(1) == 1);
)
CHEAT_TEST(reverse_number,
cheat_assert(reverse_number(123456) == 654321);
cheat_assert(reverse_number(321) == 123);
)
CHEAT_TEST(mcd,
cheat_assert(mcd(2,3) == 1);
cheat_assert(mcd(12,2) == 2);
cheat_assert(mcd(48,60) == 12);
)
CHEAT_TEST(pow_recursive,
cheat_assert(pow_recursive(2,3) == 8);
cheat_assert(pow_recursive(3,5) == 243);
)
CHEAT_TEST(product,
cheat_assert(product(2,3) == 6);
cheat_assert(product(3,2) == 6);
cheat_assert(product(5,5) == 25);
)
CHEAT_TEST(bubble_sort,
int v[10] = {9,8,7,6,5,4,3,2,1,0};
bubble_sort(v,10);
for(int i = 0; i < 10; ++i){
cheat_assert( v[i] == i);
}
)
CHEAT_TEST(insertion_sort,
int v[10] = {9,8,7,6,5,4,3,2,1,0};
insertion_sort(v,10);
for(int i = 0; i < 10; ++i){
cheat_assert( v[i] == i);
}
)
CHEAT_TEST(selection_sort,
int v[10] = {9,8,7,6,5,4,3,2,1,0};
selection_sort(v,10);
for(int i = 0; i < 10; ++i){
cheat_assert( v[i] == i);
}
)