Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. int distance1[7] = { 2, 4, 1, 3, 2, 1, 13 }
  2. char word1[7][MAX_WORD_LENGTH + 1] = { "mad", "deranged", "NEFARIOUS", "half-witted", "robot", "plot", "have" };
  3. char word2[7][MAX_WORD_LENGTH + 1] = { "scientist", "robot", "plot", "assistant", "deranged", "Nefarious", "mad" };
  4. standardizeRules(distance1, word1, word2, 7);
  5. // basic standardizeRules test, 2 duplicate match cases, capitalization + non-alphabetic
  6.  
  7. int distance2[3] = { -1, 0, 1 };
  8. char word1[3][MAX_WORD_LENGTH + 1] = { "mad", "deranged", "nefarious" };
  9. char word2[3][MAX_WORD_LENGTH + 1] = { "scientist", "robot", "" };
  10. standardizeRules(distance2, word1, word2, 3);
  11. // handling empty char array
  12.  
  13. int distance3[5] = { 5, 1, 10, 5, 13 };
  14. char word1[5][MAX_WORD_LENGTH + 1] = { "orange", "apple", "pear", "fruit", "fruit" };
  15. char word2[5][MAX_WORD_LENGTH + 1] = { "apple", "orange", "fruit", "pear", "pear" };
  16. standardizeRules(distance3, word1, word2, 5);
  17. // multiple duplicate match cases
  18.  
  19. int distance4[1] = { 1 };
  20. char word1[1][MAX_WORD_LENGTH + 1] = { "hello" };
  21. char word2[1][MAX_WORD_LENGTH + 1] = { "hello" };
  22. int d = standardizeRules(distance4, word1, word2, 1);
  23. // char arrays of same word
  24. const int rules = 4;
  25. int distance[rules] = {2, 4, 1, 13};
  26. char array1[rules][MAX_WORD_LENGTH + 1] = {”outer", "of", "MOO", “have" };
  27. char array2[rules][MAX_WORD_LENGTH + 1] = {"is", "cheese", "cow", “outer"};
  28.  
  29. assert(determineQuality(distance, array1, array2, rules, "The outer layer is not made of yellow cheddar cheese.") == 2);
  30. assert(determineQuality(distance, array1, array2, rules,
  31. "The outer layer is not made of cheese.") == 2); // two spaces, otherwise normal
  32. assert(determineQuality(distance, array1, array2, rules,
  33. “$W%&*@(#”) == 0); // nonalpha characters
  34. assert(determineQuality(distance, array1, array2, rules,
  35. " That cow—- MOO?”) == 1); // — and question mark, and capitalization
  36. assert(determineQuality(distance, array1, array2, rules,
  37. "of of cheese of cheese cheese") == 1); // duplicate cases of same match rule
  38. assert(determineQuality(distance, array1, array2, rules,
  39. “This outer layer of-cheese ain’t delicious.”) == 0); // hyphenated words
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement