Sha256: 00242da083d939a9e1ff644f3ecfac6233ed7e8d513054cad8b5424408271a62

Contents?: true

Size: 1.24 KB

Versions: 135

Compression:

Stored size: 1.24 KB

Contents

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

void test_strand_count(const char *dna_strand, const char *expected)
{
   char *actual_count = count(dna_strand);

   TEST_ASSERT_TRUE(strcmp(actual_count, expected) == 0);
   free(actual_count);
}

void test_empty_strand(void)
{
   const char *dna_strand = "";
   const char *expected = "A:0 C:0 G:0 T:0";

   test_strand_count(dna_strand, expected);
}

void test_repeated_nucleotide(void)
{
   const char *dna_strand = "GGGGGGG";
   const char *expected = "A:0 C:0 G:7 T:0";

   test_strand_count(dna_strand, expected);
}

void test_multiple_nucleotides(void)
{
   const char *dna_strand =
       "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC";
   const char *expected = "A:20 C:12 G:17 T:21";

   test_strand_count(dna_strand, expected);
}

void test_invalid_nucleotide(void)
{
   const char *dna_strand = "AGXXACT";
   const char *expected = "";

   test_strand_count(dna_strand, expected);
}

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

   RUN_TEST(test_empty_strand);
   RUN_TEST(test_repeated_nucleotide);
   RUN_TEST(test_multiple_nucleotides);
   RUN_TEST(test_invalid_nucleotide);

   UnityEnd();
   return 0;
}

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
trackler-2.2.1.42 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.41 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.40 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.39 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.38 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.37 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.36 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.35 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.34 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.33 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.32 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.31 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.30 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.29 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.28 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.27 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.26 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.25 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.24 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c
trackler-2.2.1.23 tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c