All tests calculating the length of the word passed

This commit is contained in:
ollo 2017-03-01 18:28:37 +01:00
parent 068f4b62e2
commit 6621dee748
2 changed files with 19 additions and 5 deletions

View File

@ -56,7 +56,7 @@ expected.itis=1
expected.one=1 expected.one=1
expected.clock=1 expected.clock=1
checkWords(leds, expected, 1, 0) checkWords(leds, expected, 1, 0)
checkCharacter(display_countwords_de(leds), 12) checkCharacter(display_countwords_de(leds), 11)
leds=display_timestat(2,5) leds=display_timestat(2,5)
expected={} expected={}
@ -142,7 +142,7 @@ checkCharacter(display_countwords_de(leds), 12)
leds=display_timestat(12,55) leds=display_timestat(12,55)
expected={} expected={}
expected.one=1 expected.oneLong=1
expected.fiveMin=1 expected.fiveMin=1
expected.before=1 expected.before=1
checkWords(leds, expected, 12 , 55) checkWords(leds, expected, 12 , 55)
@ -164,6 +164,7 @@ expected.two=1
expected.min1=1 expected.min1=1
expected.clock=1 expected.clock=1
checkWords(leds, expected, 14 , 01) checkWords(leds, expected, 14 , 01)
checkCharacter(display_countwords_de(leds), 12)
leds=display_timestat(15,02) leds=display_timestat(15,02)
expected={} expected={}
@ -172,6 +173,7 @@ expected.three=1
expected.min2=1 expected.min2=1
expected.clock=1 expected.clock=1
checkWords(leds, expected, 15 , 02) checkWords(leds, expected, 15 , 02)
checkCharacter(display_countwords_de(leds), 12)
leds=display_timestat(16,03) leds=display_timestat(16,03)
expected={} expected={}
@ -180,6 +182,7 @@ expected.four=1
expected.min3=1 expected.min3=1
expected.clock=1 expected.clock=1
checkWords(leds, expected, 16 , 03) checkWords(leds, expected, 16 , 03)
checkCharacter(display_countwords_de(leds), 12)
leds=display_timestat(17,04) leds=display_timestat(17,04)
expected={} expected={}
@ -188,6 +191,7 @@ expected.five=1
expected.min4=1 expected.min4=1
expected.clock=1 expected.clock=1
checkWords(leds, expected, 17 , 04) checkWords(leds, expected, 17 , 04)
checkCharacter(display_countwords_de(leds), 12)
leds=display_timestat(18,06) leds=display_timestat(18,06)
expected={} expected={}
@ -196,6 +200,7 @@ expected.after=1
expected.min1=1 expected.min1=1
expected.six=1 expected.six=1
checkWords(leds, expected, 18 , 06) checkWords(leds, expected, 18 , 06)
checkCharacter(display_countwords_de(leds), 13)
leds=display_timestat(19,09) leds=display_timestat(19,09)
expected={} expected={}
@ -204,6 +209,7 @@ expected.after=1
expected.min4=1 expected.min4=1
expected.seven=1 expected.seven=1
checkWords(leds, expected, 19 , 09) checkWords(leds, expected, 19 , 09)
checkCharacter(display_countwords_de(leds), 14)
leds=display_timestat(20,17) leds=display_timestat(20,17)
expected={} expected={}
@ -212,6 +218,7 @@ expected.after=1
expected.min2=1 expected.min2=1
expected.eight=1 expected.eight=1
checkWords(leds, expected, 20 , 17) checkWords(leds, expected, 20 , 17)
checkCharacter(display_countwords_de(leds), 15)

View File

@ -13,7 +13,7 @@ function display_timestat(hours, minutes, longmode)
-- generate an empty return type -- generate an empty return type
local ret = { itis=0, fiveMin=0, tenMin=0, after=0, before=0, threeHour=0, quater=0, threequater=0, half=0, s=0, local ret = { itis=0, fiveMin=0, tenMin=0, after=0, before=0, threeHour=0, quater=0, threequater=0, half=0, s=0,
one=0, two=0, three=0, four=0, five=0, six=0, seven=0, eight=0, nine=0, ten=0, eleven=0, twelve=0, one=0, oneLong=0, two=0, three=0, four=0, five=0, six=0, seven=0, eight=0, nine=0, ten=0, eleven=0, twelve=0,
twenty=0, twenty=0,
clock=0, sr_nc=0, min1=0, min2=0, min3=0, min4=0 } clock=0, sr_nc=0, min1=0, min2=0, min3=0, min4=0 }
@ -104,7 +104,11 @@ function display_timestat(hours, minutes, longmode)
end end
if (hours == 1) then if (hours == 1) then
if (ret.before == 1) then
ret.oneLong = 1
else
ret.one=1 ret.one=1
end
elseif (hours == 2) then elseif (hours == 2) then
ret.two=1 ret.two=1
elseif (hours == 3) then elseif (hours == 3) then
@ -172,6 +176,9 @@ function display_countwords_de(words)
amount = amount + 6 amount = amount + 6
end end
if (words.one == 1) then if (words.one == 1) then
amount = amount + 3
end
if (words.oneLong == 1) then
amount = amount + 4 amount = amount + 4
end end
if (words.two == 1) then if (words.two == 1) then