#include "vendor/unity.h" #include "../src/hamming.h" void setUp(void) { } void tearDown(void) { } static void test_empty_strands(void) { TEST_ASSERT_EQUAL(0, compute("", "")); } static void test_single_identical_strands(void) { TEST_ASSERT_EQUAL(0, compute("A", "A")); } static void test_single_letter_different_strands(void) { TEST_ASSERT_EQUAL(1, compute("G", "T")); } static void test_long_identical_strands(void) { TEST_ASSERT_EQUAL(0, compute("GGACTGAAATCTG", "GGACTGAAATCTG")); } static void test_long_different_strands(void) { TEST_ASSERT_EQUAL(9, compute("GGACGGATTCTG", "AGGACGGATTCT")); } static void test_disallow_first_strand_when_longer(void) { TEST_ASSERT_EQUAL(-1, compute("AATG", "AAA")); } static void test_disallow_second_strand_when_longer(void) { TEST_ASSERT_EQUAL(-1, compute("ATA", "AGTG")); } int main(void) { UnityBegin("test/test_hamming.c"); RUN_TEST(test_empty_strands); RUN_TEST(test_single_identical_strands); RUN_TEST(test_single_letter_different_strands); RUN_TEST(test_long_identical_strands); RUN_TEST(test_long_different_strands); RUN_TEST(test_disallow_first_strand_when_longer); RUN_TEST(test_disallow_second_strand_when_longer); return UnityEnd(); }