|
| 1 | +#include <project.h> |
| 2 | + |
| 3 | +int ft_isdigit(int i); |
| 4 | + |
| 5 | +#define mt_test_isdigit(test_name, tested_char) \ |
| 6 | + static void test_## test_name(t_test *test) \ |
| 7 | + { \ |
| 8 | + mt_assert(ft_isdigit(tested_char) == isdigit(tested_char)); \ |
| 9 | + } |
| 10 | + |
| 11 | +mt_test_isdigit(num1, 'a'); |
| 12 | +mt_test_isdigit(num2, 'a' + 0x100); |
| 13 | +mt_test_isdigit(num3, '2'); |
| 14 | +mt_test_isdigit(num4, 'Z'); |
| 15 | +mt_test_isdigit(num5, 't'); |
| 16 | +mt_test_isdigit(num6, 0); |
| 17 | +mt_test_isdigit(num7, 1); |
| 18 | +mt_test_isdigit(num8, 9999); |
| 19 | +mt_test_isdigit(num9, '1'); |
| 20 | +mt_test_isdigit(num10, '2'); |
| 21 | +mt_test_isdigit(num11, 'A'); |
| 22 | +mt_test_isdigit(num12, 'Z'); |
| 23 | +mt_test_isdigit(num13, ' '); |
| 24 | +mt_test_isdigit(num14, '%'); |
| 25 | +mt_test_isdigit(num15, '\t'); |
| 26 | +mt_test_isdigit(num16, '\n'); |
| 27 | +mt_test_isdigit(num17, '\v'); |
| 28 | +mt_test_isdigit(num18, '\b'); |
| 29 | +mt_test_isdigit(num19, 7); |
| 30 | +mt_test_isdigit(num20, '0'); |
| 31 | +mt_test_isdigit(num21, '0' - 1); |
| 32 | +mt_test_isdigit(num22, '9'); |
| 33 | +mt_test_isdigit(num23, '9' + 1); |
| 34 | +mt_test_isdigit(num24, -1); |
| 35 | + |
| 36 | +void suite_00_part1_ft_isdigit(t_suite *suite) |
| 37 | +{ |
| 38 | + SUITE_ADD_TEST(suite, test_num1); |
| 39 | + SUITE_ADD_TEST(suite, test_num2); |
| 40 | + SUITE_ADD_TEST(suite, test_num3); |
| 41 | + SUITE_ADD_TEST(suite, test_num4); |
| 42 | + SUITE_ADD_TEST(suite, test_num5); |
| 43 | + SUITE_ADD_TEST(suite, test_num6); |
| 44 | + SUITE_ADD_TEST(suite, test_num7); |
| 45 | + SUITE_ADD_TEST(suite, test_num8); |
| 46 | + SUITE_ADD_TEST(suite, test_num9); |
| 47 | + SUITE_ADD_TEST(suite, test_num10); |
| 48 | + SUITE_ADD_TEST(suite, test_num11); |
| 49 | + SUITE_ADD_TEST(suite, test_num12); |
| 50 | + SUITE_ADD_TEST(suite, test_num13); |
| 51 | + SUITE_ADD_TEST(suite, test_num14); |
| 52 | + SUITE_ADD_TEST(suite, test_num15); |
| 53 | + SUITE_ADD_TEST(suite, test_num16); |
| 54 | + SUITE_ADD_TEST(suite, test_num17); |
| 55 | + SUITE_ADD_TEST(suite, test_num18); |
| 56 | + SUITE_ADD_TEST(suite, test_num19); |
| 57 | + SUITE_ADD_TEST(suite, test_num20); |
| 58 | + SUITE_ADD_TEST(suite, test_num21); |
| 59 | + SUITE_ADD_TEST(suite, test_num22); |
| 60 | + SUITE_ADD_TEST(suite, test_num23); |
| 61 | + SUITE_ADD_TEST(suite, test_num24); |
| 62 | + |
| 63 | +} |
0 commit comments