exercism

Exercism solutions.
git clone git://code.dwrz.net/exercism
Log | Files | Refs

test_difference_of_squares.c (1645B)


      1 #include "vendor/unity.h"
      2 #include "../src/difference_of_squares.h"
      3 
      4 void setUp(void)
      5 {
      6 }
      7 
      8 void tearDown(void)
      9 {
     10 }
     11 
     12 void test_square_of_sum_up_to_5(void)
     13 {
     14    TEST_ASSERT_EQUAL(225, square_of_sum(5));
     15 }
     16 
     17 void test_square_of_sum_up_to_10(void)
     18 {
     19    TEST_ASSERT_EQUAL(3025, square_of_sum(10));
     20 }
     21 
     22 void test_square_of_sum_up_to_100(void)
     23 {
     24    TEST_ASSERT_EQUAL(25502500, square_of_sum(100));
     25 }
     26 
     27 void test_sum_of_squares_up_to_5(void)
     28 {
     29    TEST_ASSERT_EQUAL(55, sum_of_squares(5));
     30 }
     31 
     32 void test_sum_of_squares_up_to_10(void)
     33 {
     34    TEST_ASSERT_EQUAL(385, sum_of_squares(10));
     35 }
     36 
     37 void test_sum_of_squares_up_to_100(void)
     38 {
     39    TEST_ASSERT_EQUAL(338350, sum_of_squares(100));
     40 }
     41 
     42 void test_difference_of_squares_up_to_0(void)
     43 {
     44    TEST_ASSERT_EQUAL(0, difference_of_squares(0));
     45 }
     46 
     47 void test_difference_of_squares_up_to_5(void)
     48 {
     49    TEST_ASSERT_EQUAL(170, difference_of_squares(5));
     50 }
     51 
     52 void test_difference_of_squares_up_to_10(void)
     53 {
     54    TEST_ASSERT_EQUAL(2640, difference_of_squares(10));
     55 }
     56 
     57 void test_difference_of_squares_up_to_100(void)
     58 {
     59    TEST_ASSERT_EQUAL(25164150, difference_of_squares(100));
     60 }
     61 
     62 int main(void)
     63 {
     64    UnityBegin("test/test_difference_of_squares.c");
     65 
     66    RUN_TEST(test_square_of_sum_up_to_5);
     67    RUN_TEST(test_square_of_sum_up_to_10);
     68    RUN_TEST(test_square_of_sum_up_to_100);
     69    RUN_TEST(test_sum_of_squares_up_to_5);
     70    RUN_TEST(test_sum_of_squares_up_to_10);
     71    RUN_TEST(test_sum_of_squares_up_to_100);
     72    RUN_TEST(test_difference_of_squares_up_to_0);
     73    RUN_TEST(test_difference_of_squares_up_to_5);
     74    RUN_TEST(test_difference_of_squares_up_to_10);
     75    RUN_TEST(test_difference_of_squares_up_to_100);
     76 
     77    return UnityEnd();
     78 }