---
# System prepended metadata

title: CS613-2019 Quiz1 Test cases

---

# CS613-2019 Quiz1 Test cases

## Q3 (Stern Broccot)
```haskell
  -- 6 cases
  lcaCases = [(2%3, 2%723), (87%321, 2%723), (6%87, 2%723), (4%3, 8%6), (1%1, 8%6), (3%8, 3%7)]
  
  -- 9 cases
  justBelowCases = [(5, 3%7), (6, 3%7), (4, 23%7), (18, 23%7), (9, 17%7), (12, 17%7), (3, 1%1), (9, 1%1), (4, 3%9)]

  Solution3.check lca Solution3.lca lcaCases
  Solution3.check justBelow Solution3.justBelow justBelowCases
```

## Q4 Cryptanalysis
```haskell
subCases = [("POWASQERBCDFGHIJKLMNTUVXYZ", 'c'), ("POWASQERBCDFGHIJKLMNTUVXYZ", '@'), ("POWASQERBCDFGHIJKLMNTUVXYZ", ' '), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'D'), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'A'), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'R')]
unsubCases = [("POWASQERBCDFGHIJKLMNTUVXYZ", 'c'), ("POWASQERBCDFGHIJKLMNTUVXYZ", '@'), ("POWASQERBCDFGHIJKLMNTUVXYZ", ' '), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'A'), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'P'), ("POWASQERBCDFGHIJKLMNTUVXYZ", 'L')]
Solution4.check sub Solution4.sub subCases
Solution4.check unsub Solution4.unsub unsubCases

albus = "ALBUS PERCIVAL WULFRIC BriAN DUMBLEDORE"
encodeKeyCases = [("SWORDFISH", "AMITABHA SANYAL"), ("SWORDFISH", "aMITABHA S@N YAL"), ("MEZZANINE", albus)]
decodeKeyCases = [("SWORDFISH", "SGAQSWHS PSJYSE"), ("SWORDFISH", "aGAQSWHS P@J YSE"), ("MEZZANINE", "MHETR ONQZDUMH VTHIQDZ EriMK ATJEHNALQN")]
Solution4.check encode_keyword_cipher Solution4.encode_keyword_cipher encodeKeyCases
Solution4.check decode_keyword_cipher Solution4.decode_keyword_cipher decodeKeyCases

eceaserCases = [('F', ['A'..'Z']), ('B', "FGHIJKLMNOPQRSTUVWXYZABCDE los pollos hermanos"), ('G', ['A'..'Z'] ++ " los pollos hermanos")]
dceaserCases = [('F', "FGHIJKLMNOPQRSTUVWXYZABCDE"), ('G', "GHIJKLMNOPQRSTUVWXYZABCDEF los pollos hermanos"), ('L', (Solution4.decode_ceaser 'P' albus)), ('A', albus)]
Solution4.check encode_ceaser Solution4.encode_ceaser eceaserCases
Solution4.check decode_ceaser Solution4.decode_ceaser dceaserCases
```

## How to run the test cases
First load the Solution and your submissions in a GHCi shell
`stack ghci <path-to-Qx.hs> <path-to-Solutionx.hs>`

Now you can simply use `Solution3.check` or `Solution4.check` to confirm how many cases you've cracked. Both functions return `[Bool]`, `True` indicates you passed the case.
All cases are equally weighed (look at your moodle grade comments if in doubt).

If you want to see the outputs:
```haskell
map (uncurry f) cases_list
map (uncurry Solutionx.f) cases_list
```