From 068f4b62e228bef1de1d6cecb03ffc24f996edcd Mon Sep 17 00:00:00 2001 From: ollo Date: Tue, 28 Feb 2017 19:14:09 +0100 Subject: [PATCH] More test passed --- unit/testWordClock.lua | 11 +++++++++++ wordclock.lua | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/unit/testWordClock.lua b/unit/testWordClock.lua index 8f33745..7390bc7 100644 --- a/unit/testWordClock.lua +++ b/unit/testWordClock.lua @@ -72,6 +72,7 @@ expected.three=1 expected.tenMin=1 expected.after=1 checkWords(leds, expected, 3 , 10) +checkCharacter(display_countwords_de(leds), 12) leds=display_timestat(4,15) expected={} @@ -79,6 +80,7 @@ expected.four=1 expected.after=1 expected.quater=1 checkWords(leds, expected, 4 , 15) +checkCharacter(display_countwords_de(leds), 15) leds=display_timestat(5,20) expected={} @@ -86,6 +88,7 @@ expected.five=1 expected.twenty=1 expected.after=1 checkWords(leds, expected, 5 , 20) +checkCharacter(display_countwords_de(leds), 15) leds=display_timestat(6,25) expected={} @@ -94,6 +97,7 @@ expected.fiveMin=1 expected.before=1 expected.half=1 checkWords(leds, expected, 6 , 25) +checkCharacter(display_countwords_de(leds), 17) leds=display_timestat(7,30) expected={} @@ -101,6 +105,7 @@ expected.itis=1 expected.eight=1 expected.half=1 checkWords(leds, expected, 7 , 30) +checkCharacter(display_countwords_de(leds), 13) leds=display_timestat(8,35) expected={} @@ -109,6 +114,7 @@ expected.half=1 expected.fiveMin=1 expected.after=1 checkWords(leds, expected, 8 , 35) +checkCharacter(display_countwords_de(leds), 16) leds=display_timestat(9,40) expected={} @@ -116,6 +122,7 @@ expected.ten=1 expected.twenty=1 expected.before=1 checkWords(leds, expected, 9 , 40) +checkCharacter(display_countwords_de(leds), 14) leds=display_timestat(10,45) expected={} @@ -123,6 +130,7 @@ expected.eleven=1 expected.quater=1 expected.before=1 checkWords(leds, expected, 10 , 45) +checkCharacter(display_countwords_de(leds), 13) leds=display_timestat(11,50) expected={} @@ -130,6 +138,7 @@ expected.twelve=1 expected.tenMin=1 expected.before=1 checkWords(leds, expected, 11 , 50) +checkCharacter(display_countwords_de(leds), 12) leds=display_timestat(12,55) expected={} @@ -137,6 +146,7 @@ expected.one=1 expected.fiveMin=1 expected.before=1 checkWords(leds, expected, 12 , 55) +checkCharacter(display_countwords_de(leds), 11) leds=display_timestat(13,00) expected={} @@ -144,6 +154,7 @@ expected.itis=1 expected.one=1 expected.clock=1 checkWords(leds, expected, 13 , 00) +checkCharacter(display_countwords_de(leds), 11) -- test the minutes inbetween leds=display_timestat(14,01) diff --git a/wordclock.lua b/wordclock.lua index 1ecbc98..00648d2 100755 --- a/wordclock.lua +++ b/wordclock.lua @@ -144,12 +144,12 @@ function display_countwords_de(words) if (words.fiveMin == 1) then amount = amount + 4 end + if (words.tenMin == 1) then + amount = amount + 4 + end if (words.twenty == 1) then amount = amount + 7 end - if (words.ten == 1) then - amount = amount + 4 - end if (words.threequater == 1) then amount = amount + 11 end