summary refs log tree commit diff stats
path: root/c/square-root/test/test_square_root.c
blob: b8ecc857589cc87da2c95d8dabf25fd9c8924b24 (plain) (blame)
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
#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();
}