Sha256: bf3124e9ed94d97545b1b96f8f6969ec5c9740eb9b1a597b0979b8a043fa5b8e

Contents?: true

Size: 1.56 KB

Versions: 132

Compression:

Stored size: 1.56 KB

Contents

#include "vendor/unity.h"
#include "../src/rna_transcription.h"
#include <stdlib.h>

void setUp(void)
{
}

void tearDown(void)
{
}

void test_transcription(const char *dna, const char *expected)
{
   char *rna = to_rna(dna);
   TEST_ASSERT_EQUAL_STRING(expected, rna);
   free(rna);
}

void test_failure(const char *dna)
{
   TEST_ASSERT_NULL(to_rna(dna));
}

void test_transcribes_G_to_C(void)
{
   test_transcription("G", "C");
}

void test_transcribes_C_to_G(void)
{
   TEST_IGNORE();               // delete this line to run test
   test_transcription("C", "G");
}

void test_transcribes_T_to_A(void)
{
   TEST_IGNORE();
   test_transcription("T", "A");
}

void test_transcribes_A_to_U(void)
{
   TEST_IGNORE();
   test_transcription("A", "U");
}

void test_transcribes_all_occurrences(void)
{
   TEST_IGNORE();
   test_transcription("ACGTGGTCTTAA", "UGCACCAGAAUU");
}

void test_handle_invalid_nucleotide(void)
{
   TEST_IGNORE();
   test_failure("U");
}

void test_handle_completely_invalid_input(void)
{
   TEST_IGNORE();
   test_failure("XXX");
}

void test_handle_partially_invalid_input(void)
{
   TEST_IGNORE();
   test_failure("ACGTXXXCTTAA");
}

int main(void)
{
   UnityBegin("test/test_rna_transcription.c");

   RUN_TEST(test_transcribes_G_to_C);
   RUN_TEST(test_transcribes_C_to_G);
   RUN_TEST(test_transcribes_T_to_A);
   RUN_TEST(test_transcribes_A_to_U);
   RUN_TEST(test_transcribes_all_occurrences);
   RUN_TEST(test_handle_invalid_nucleotide);
   RUN_TEST(test_handle_completely_invalid_input);
   RUN_TEST(test_handle_partially_invalid_input);

   UnityEnd();
   return 0;
}

Version data entries

132 entries across 132 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.179 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.178 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.177 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.176 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.175 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.174 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.173 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.172 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.171 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.170 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.169 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.167 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.166 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.165 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.164 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.163 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.162 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.161 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.160 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c