aboutsummaryrefslogtreecommitdiff
path: root/challenge-081/tyler-wardhaugh/lua/test.lua
diff options
context:
space:
mode:
authorMyoungjin JEON <jeongoon@gmail.com>2020-10-15 00:04:11 +1100
committerMyoungjin JEON <jeongoon@gmail.com>2020-10-15 00:04:11 +1100
commitdd71532a73981ec613c8c61d99fa4bbd3f3fd79c (patch)
tree70b1b5c1613f51461bb27f6b4aa49ba8b5efa78e /challenge-081/tyler-wardhaugh/lua/test.lua
parent99053d27c19ab6baee10484e8de730527333ddde (diff)
parenta86e289ff2bb02e7c579be9175c92f2667168a28 (diff)
downloadperlweeklychallenge-club-dd71532a73981ec613c8c61d99fa4bbd3f3fd79c.tar.gz
perlweeklychallenge-club-dd71532a73981ec613c8c61d99fa4bbd3f3fd79c.tar.bz2
perlweeklychallenge-club-dd71532a73981ec613c8c61d99fa4bbd3f3fd79c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-081/tyler-wardhaugh/lua/test.lua')
-rwxr-xr-xchallenge-081/tyler-wardhaugh/lua/test.lua25
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)