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.180 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.179 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.178 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.177 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.176 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.175 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.174 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.173 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.172 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.171 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.170 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.169 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.167 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.166 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.165 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.164 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.163 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.162 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.161 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c
trackler-2.2.1.160 tracks/c/exercises/collatz-conjecture/test/test_collatz_conjecture.c