Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int distance1[7] = { 2, 4, 1, 3, 2, 1, 13 }
- char word1[7][MAX_WORD_LENGTH + 1] = { "mad", "deranged", "NEFARIOUS", "half-witted", "robot", "plot", "have" };
- char word2[7][MAX_WORD_LENGTH + 1] = { "scientist", "robot", "plot", "assistant", "deranged", "Nefarious", "mad" };
- standardizeRules(distance1, word1, word2, 7);
- // basic standardizeRules test, 2 duplicate match cases, capitalization + non-alphabetic
- int distance2[3] = { -1, 0, 1 };
- char word1[3][MAX_WORD_LENGTH + 1] = { "mad", "deranged", "nefarious" };
- char word2[3][MAX_WORD_LENGTH + 1] = { "scientist", "robot", "" };
- standardizeRules(distance2, word1, word2, 3);
- // handling empty char array
- int distance3[5] = { 5, 1, 10, 5, 13 };
- char word1[5][MAX_WORD_LENGTH + 1] = { "orange", "apple", "pear", "fruit", "fruit" };
- char word2[5][MAX_WORD_LENGTH + 1] = { "apple", "orange", "fruit", "pear", "pear" };
- standardizeRules(distance3, word1, word2, 5);
- // multiple duplicate match cases
- int distance4[1] = { 1 };
- char word1[1][MAX_WORD_LENGTH + 1] = { "hello" };
- char word2[1][MAX_WORD_LENGTH + 1] = { "hello" };
- int d = standardizeRules(distance4, word1, word2, 1);
- // char arrays of same word
- const int rules = 4;
- int distance[rules] = {2, 4, 1, 13};
- char array1[rules][MAX_WORD_LENGTH + 1] = {”outer", "of", "MOO", “have" };
- char array2[rules][MAX_WORD_LENGTH + 1] = {"is", "cheese", "cow", “outer"};
- assert(determineQuality(distance, array1, array2, rules, "The outer layer is not made of yellow cheddar cheese.") == 2);
- assert(determineQuality(distance, array1, array2, rules,
- "The outer layer is not made of cheese.") == 2); // two spaces, otherwise normal
- assert(determineQuality(distance, array1, array2, rules,
- “$W%&*@(#”) == 0); // nonalpha characters
- assert(determineQuality(distance, array1, array2, rules,
- " That cow—- MOO?”) == 1); // — and question mark, and capitalization
- assert(determineQuality(distance, array1, array2, rules,
- "of of cheese of cheese cheese") == 1); // duplicate cases of same match rule
- assert(determineQuality(distance, array1, array2, rules,
- “This outer layer of-cheese ain’t delicious.”) == 0); // hyphenated words
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement