blob: 5e861796203aad2796f3f3a84b078b3fa230a034 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include "vendor/unity.h"
#include "../src/difference_of_squares.h"
void setUp(void)
{
}
void tearDown(void)
{
}
static void test_square_of_sum_1(void)
{
TEST_ASSERT_EQUAL(1, square_of_sum(1));
}
static void test_square_of_sum_5(void)
{
TEST_ASSERT_EQUAL(225, square_of_sum(5));
}
static void test_square_of_sum_100(void)
{
TEST_ASSERT_EQUAL(25502500, square_of_sum(100));
}
static void test_sum_of_squares_1(void)
{
TEST_ASSERT_EQUAL(1, sum_of_squares(1));
}
static void test_sum_of_squares_5(void)
{
TEST_ASSERT_EQUAL(55, sum_of_squares(5));
}
static void test_sum_of_squares_100(void)
{
TEST_ASSERT_EQUAL(338350, sum_of_squares(100));
}
static void test_difference_of_squares_1(void)
{
TEST_ASSERT_EQUAL(0, difference_of_squares(1));
}
static void test_difference_of_squares_5(void)
{
TEST_ASSERT_EQUAL(170, difference_of_squares(5));
}
static void test_difference_of_squares_100(void)
{
TEST_ASSERT_EQUAL(25164150, difference_of_squares(100));
}
int main(void)
{
UnityBegin("test/test_difference_of_squares.c");
RUN_TEST(test_square_of_sum_1);
RUN_TEST(test_square_of_sum_5);
RUN_TEST(test_square_of_sum_100);
RUN_TEST(test_sum_of_squares_1);
RUN_TEST(test_sum_of_squares_5);
RUN_TEST(test_sum_of_squares_100);
RUN_TEST(test_difference_of_squares_1);
RUN_TEST(test_difference_of_squares_5);
RUN_TEST(test_difference_of_squares_100);
return UnityEnd();
}
|