diff options
Diffstat (limited to 'challenge-081/tyler-wardhaugh/lua/test.lua')
| -rwxr-xr-x | challenge-081/tyler-wardhaugh/lua/test.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-081/tyler-wardhaugh/lua/test.lua b/challenge-081/tyler-wardhaugh/lua/test.lua new file mode 100755 index 0000000000..0874b984cc --- /dev/null +++ b/challenge-081/tyler-wardhaugh/lua/test.lua @@ -0,0 +1,25 @@ +#!/usr/bin/env lua + +require 'busted.runner'() + +describe("Task 1, Common Base String", function() + local t1 = require'ch-1' + it("produces correct results for the examples", function() + assert.are.same(t1.common_base_string("abcdabcd", "abcdabcdabcdabcd"), {"abcdabcd", "abcd"}) + assert.are.same(t1.common_base_string("aaa", "aa"), {"a"}) + end) +end) + +describe("Task 2, Frequency Sort", function() + local t2 = require'ch-2' + it("produces correct results for the examples", function() + local expected = { + [1]={"But", "City", "It", "Jet", "Juliet", "Latino", "New", "Romeo", "Side", "Story", "Their", "Then", "West", "York", "adaptation", "any", "anything", "at", "award-winning", "away", "become", "before", "begin", "best", "classic", "climactic", "coexist", "control", "dance", "do", "doesn't", "end", "ending", "escalates", "families", "feuding", "form", "former", "friend", "gains", "gangs", "goes", "happened", "hatred", "heartbreaking", "highway", "hoping", "in", "know", "love", "lovers", "meet", "meeting", "neither", "no", "one", "plan", "planning", "point", "romantic", "rumble", "run", "secret", "sends", "sister", "streets", "strikes", "terribly", "their", "two", "under", "understanding", "until", "violence", "warring", "what", "when", "where", "white", "whoever", "wins", "with", "wrong", "younger"}, + [2]={"Bernardo", "Jets", "Riff", "Sharks", "The", "by", "it", "led", "tragedy"}, + [3]={"Maria", "Tony", "a", "can", "of", "stop"}, + [4]={"to"}, + [9]={"and", "the"} + } + assert.are.same(t2.frequency_sort(t2.slurp("resources/input")), expected) + end) +end) |
