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.98 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.97 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.96 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.95 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.94 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.93 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.92 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.91 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.90 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.89 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.88 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.87 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.86 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.85 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.84 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.83 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.82 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.81 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.80 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c
trackler-2.2.1.79 tracks/c/exercises/rna-transcription/test/test_rna_transcription.c