Skip to content

Commit

Permalink
Updating test for Crypto Square (#1029)
Browse files Browse the repository at this point in the history
* Updating test for Crypto Square

* Update exercises/practice/crypto-square/test_crypto_square.c

Co-authored-by: wolf99 <281700+wolf99@users.noreply.github.com>

* Updating test name

---------

Co-authored-by: wolf99 <281700+wolf99@users.noreply.github.com>
  • Loading branch information
jagdish-15 and wolf99 authored Jan 9, 2025
1 parent e30aae9 commit 7c737af
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions exercises/practice/crypto-square/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
],
"contributors": [
"h-3-0",
"jagdish-15",
"patricksjackson",
"QLaille",
"ryanplusplus",
Expand Down
16 changes: 13 additions & 3 deletions exercises/practice/crypto-square/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[407c3837-9aa7-4111-ab63-ec54b58e8e9f]
description = "empty plaintext results in an empty ciphertext"

[aad04a25-b8bb-4304-888b-581bea8e0040]
description = "normalization results in empty plaintext"

[64131d65-6fd9-4f58-bdd8-4a2370fb481d]
description = "Lowercase"

Expand Down
13 changes: 12 additions & 1 deletion exercises/practice/crypto-square/test_crypto_square.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ static void test_empty_text_res_in_an_empty_ciphertext(void)
free(res);
}

static void test_lowercase(void)
static void test_normalization_results_in_empty_plaintext(void)
{
TEST_IGNORE(); // delete this line to run test
const char *input = "... --- ...";
const char *expected = "";
char *res = ciphertext(input);
TEST_ASSERT_EQUAL_STRING(expected, res);
free(res);
}

static void test_lowercase(void)
{
TEST_IGNORE();
const char *input = "A";
const char *expected = "a";
char *res = ciphertext(input);
Expand Down Expand Up @@ -88,6 +98,7 @@ int main(void)
UNITY_BEGIN();

RUN_TEST(test_empty_text_res_in_an_empty_ciphertext);
RUN_TEST(test_normalization_results_in_empty_plaintext);
RUN_TEST(test_lowercase);
RUN_TEST(test_remove_spaces);
RUN_TEST(test_remove_punctuation);
Expand Down

0 comments on commit 7c737af

Please sign in to comment.