Skip to content

Commit

Permalink
minunit fork used
Browse files Browse the repository at this point in the history
  • Loading branch information
devsli committed Jul 24, 2015
1 parent e3a3449 commit b947a7e
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 42 deletions.
62 changes: 25 additions & 37 deletions tests/fjk_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,35 @@

int tests_run = 0;

static char * test_tiny_encrypt() {
mu_assert("error, encryption of '123456' is not equal to '531642'",
strncmp(fjk_encrypt("123456", 6), "531642", 6) == 0);
mu_assert("error, encryption of '1234567' is not equal to '7531642'",
strncmp(fjk_encrypt("1234567", 7), "7531642", 7) == 0);
mu_assert("error, encryption of '12345678' is not equal to '87531642'",
strncmp(fjk_encrypt("12345678", 8), "87531642", 8) == 0);
mu_assert("error, encryption of '123456789' is not equal to '741852963'",
strncmp(fjk_encrypt("123456789", 9), "741852963", 9) == 0);

return 0;
}
MU_TEST(encrypt_6) { mu_assert(strncmp(fjk_encrypt("123456", 6), "531642", 6) == 0, "encryption of '123456' is not equal to '531642'"); }
MU_TEST(encrypt_7) { mu_assert(strncmp(fjk_encrypt("1234567", 7), "7531642", 7) == 0, "encryption of '1234567' is not equal to '7531642'"); }
MU_TEST(encrypt_8) { mu_assert(strncmp(fjk_encrypt("12345678", 8), "87531642", 8) == 0, "encryption of '12345678' is not equal to '87531642'"); }
MU_TEST(encrypt_9) { mu_assert(strncmp(fjk_encrypt("123456789", 9), "741852963", 9) == 0, "encryption of '123456789' is not equal to '741852963'"); }

MU_TEST(decrypt_6) { mu_assert(strncmp(fjk_decrypt("531642", 6), "123456", 6) == 0, "decryption of '531642' is not equal to '123456'"); }
MU_TEST(decrypt_7) { mu_assert(strncmp(fjk_decrypt("7531642", 7), "1234567", 7) == 0, "decryption of '7531642' is not equal to '1234567'"); }
MU_TEST(decrypt_8) { mu_assert(strncmp(fjk_decrypt("87531642", 8), "12345678", 8) == 0, "decryption of '87531642' is not equal to '12345678'"); }
MU_TEST(decrypt_9) { mu_assert(strncmp(fjk_decrypt("741852963", 9), "123456789", 9) == 0, "decryption of '741852963' is not equal to '123456789'"); }



static char * test_tiny_decrypt() {
mu_assert("error, decryption of '531642' is not equal to '123456'",
strncmp(fjk_decrypt("531642", 6), "123456", 6) == 0);
mu_assert("error, decryption of '7531642' is not equal to '1234567'",
strncmp(fjk_decrypt("7531642", 7), "1234567", 7) == 0);
mu_assert("error, decryption of '87531642' is not equal to '12345678'",
strncmp(fjk_decrypt("87531642", 8), "12345678", 8) == 0);
mu_assert("error, decryption of '741852963' is not equal to '123456789'",
strncmp(fjk_decrypt("741852963", 9), "123456789", 9) == 0);

return 0;
MU_TEST_SUITE(encryption_suite) {
MU_RUN_TEST(encrypt_6);
MU_RUN_TEST(encrypt_7);
MU_RUN_TEST(encrypt_8);
MU_RUN_TEST(encrypt_9);
}

static char * all_tests() {
mu_run_test(test_tiny_encrypt);
mu_run_test(test_tiny_decrypt);
return 0;
MU_TEST_SUITE(decryption_suite) {
MU_RUN_TEST(decrypt_6);
MU_RUN_TEST(decrypt_7);
MU_RUN_TEST(decrypt_8);
MU_RUN_TEST(decrypt_9);
}

int main(void) {
char *result = all_tests();
if (result != 0) {
printf("%s\n", result);
}
else {
printf("ALL TESTS PASSED\n");
}
printf("Tests run: %d\n", tests_run);

return result != 0;
MU_RUN_SUITE(encryption_suite);
MU_RUN_SUITE(decryption_suite);
MU_REPORT();
return 0;
}
Loading

0 comments on commit b947a7e

Please sign in to comment.