diff options
Diffstat (limited to 'c/square-root/test/test_square_root.c')
-rw-r--r-- | c/square-root/test/test_square_root.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/c/square-root/test/test_square_root.c b/c/square-root/test/test_square_root.c new file mode 100644 index 0000000..b8ecc85 --- /dev/null +++ b/c/square-root/test/test_square_root.c @@ -0,0 +1,54 @@ +#include "vendor/unity.h" +#include "../src/square_root.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +static void test_root_of_1(void) +{ + TEST_ASSERT_EQUAL_UINT16(1, square_root(1)); +} + +static void test_root_of_4(void) +{ + TEST_ASSERT_EQUAL_UINT16(2, square_root(4)); +} + +static void test_root_of_25(void) +{ + TEST_ASSERT_EQUAL_UINT16(5, square_root(25)); +} + +static void test_root_of_81(void) +{ + TEST_ASSERT_EQUAL_UINT16(9, square_root(81)); +} + +static void test_root_of_196(void) +{ + TEST_ASSERT_EQUAL_UINT16(14, square_root(196)); +} + +static void test_root_of_65025(void) +{ + TEST_ASSERT_EQUAL_UINT16(255, square_root(65025)); +} + +int main(void) +{ + UnityBegin("test/test_square_root.c"); + + RUN_TEST(test_root_of_1); + RUN_TEST(test_root_of_4); + RUN_TEST(test_root_of_25); + RUN_TEST(test_root_of_81); + RUN_TEST(test_root_of_196); + RUN_TEST(test_root_of_65025); + + return UnityEnd(); +} |