Sha256: a439ca2a9d0b1c442c293a062294d805aabc14fc05a5c878c70498754feaaca3

Contents?: true

Size: 901 Bytes

Versions: 125

Compression:

Stored size: 901 Bytes

Contents

#include "../src/collatz_conjecture.h"

#include "vendor/unity.h"

void test_zero_steps_for_one(void)
{
   TEST_ASSERT_EQUAL(0, steps(1));
}

void test_divide_if_even(void)
{
   TEST_ASSERT_EQUAL(4, steps(16));
}

void test_even_and_odd_steps(void)
{
   TEST_ASSERT_EQUAL(9, steps(12));
}

void test_large_number_of_even_and_odd_steps(void)
{
   TEST_ASSERT_EQUAL(152, steps(1000000));
}

void test_zero_is_an_error(void)
{
   TEST_ASSERT_EQUAL(ERROR_VALUE, steps(0));
}

void test_negative_value_is_an_error(void)
{
   TEST_ASSERT_EQUAL(ERROR_VALUE, steps(-15));
}

int main(void)
{
   UnityBegin("collatz_conjecture.c");

   RUN_TEST(test_zero_steps_for_one);
   RUN_TEST(test_divide_if_even);
   RUN_TEST(test_even_and_odd_steps);
   RUN_TEST(test_large_number_of_even_and_odd_steps);
   RUN_TEST(test_zero_is_an_error);
   RUN_TEST(test_negative_value_is_an_error);

   UnityEnd();
   return 0;
}

Version data entries

125 entries across 125 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.118 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.117 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.116 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.115 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.114 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.113 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.111 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.110 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.109 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.108 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.107 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.106 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.105 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.104 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.103 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.102 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.101 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.100 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.99 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c