Skip to content

Instantly share code, notes, and snippets.

@henryhamon
Last active April 17, 2022 00:35
Show Gist options
  • Save henryhamon/dc9f2fd17869744257f9cf3254957cf7 to your computer and use it in GitHub Desktop.
Save henryhamon/dc9f2fd17869744257f9cf3254957cf7 to your computer and use it in GitHub Desktop.
codeGolf.Anagram
Class codeGolf.Anagram
{
ClassMethod Detector(a As %String, b As %String) As %Boolean
{
; your code here
Q 0
}
}
Class codeGolf.test.Anagram Extends %UnitTest.TestCase
{
Method TestBasic()
{
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Listen", "Silent"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("restful", "fluster"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("foefet", "toffee"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("evil", "vile"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Coronavirus", "Carnivorous"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("ound", "round"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("apple", "pale"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("outher", "routhes"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("Retrieve", "Revieve"))
}
Method TestAdvanced()
{
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("funeral", "real fun"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("adultery", "true lady"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("forty five", "over fifty"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("New York Times", "monkeys write"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Rocket Boys", "October Sky"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Anna Madrigal", "A man and a girl"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Tom Marvolo Riddle", "I am Lord Voldemort"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Damon Albarn", "Dan Abnormal"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Dave Barry", "Ray Adverb"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Arrigo Boito", "Tobia Gorrio"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("a gentleman", "elegant man"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("eleven plus two", "twelve plus one"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("William Shakespeare", "I am a weakish speller"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Madam Curie", "Radium came"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("Ronald Wilson Reagan", "Insane anglo warlord"))
Do $$$AssertTrue(##class(codeGolf.Anagram).Detector("George Bush", "He bugs Gore"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("Ted Morgan", "Sanche de Gramont"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("Vivian Bloodmark", "Bladak Vinomor"))
Do $$$AssertNotTrue(##class(codeGolf.Anagram).Detector("Navckid Keyd", "Thela Hun Ginjeet"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment