• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 14860011647

06 May 2025 12:44PM UTC coverage: 67.057% (+32.5%) from 34.559%
14860011647

push

github

alerque
chore(typesetters): Fixup access to class from typesetter functions

7 of 7 new or added lines in 2 files covered. (100.0%)

1344 existing lines in 103 files now uncovered.

14880 of 22190 relevant lines covered (67.06%)

11549.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.24
/languages/en/init.lua
1
local unicode = require("languages.unicode")
153✔
2

3
local language = pl.class(unicode)
153✔
4
language._name = "en"
153✔
5

6
local function digits (num)
7
   local i, ret = -1
×
8
   return function ()
UNCOV
9
      i, ret = i + 1, num % 10
×
UNCOV
10
      if num > 0 then
×
UNCOV
11
         num = math.floor(num / 10)
×
UNCOV
12
         return i, ret
×
13
      end
14
   end
15
end
16

17
function language:numberToString (num)
153✔
UNCOV
18
   local words = { "one ", "two ", "three ", "four ", "five ", "six ", "seven ", "eight ", "nine " }
×
19
   local levels = {
×
20
      "thousand ",
21
      "million ",
22
      "billion ",
23
      "trillion ",
24
      "quadrillion ",
25
      "quintillion ",
26
      "sextillion ",
27
      "septillion ",
28
      "octillion ",
29
      [0] = "",
30
   }
UNCOV
31
   local iwords = { "ten ", "twenty ", "thirty ", "forty ", "fifty ", "sixty ", "seventy ", "eighty ", "ninety " }
×
32
   local twords =
UNCOV
33
      { "eleven ", "twelve ", "thirteen ", "fourteen ", "fifteen ", "sixteen ", "seventeen ", "eighteen ", "nineteen " }
×
34

UNCOV
35
   local level = false
×
36
   local function getname (pos, dig) --stateful, but effective.
37
      level = level or pos % 3 == 0
×
38
      if dig == 0 then
×
UNCOV
39
         return ""
×
40
      end
41
      local name = (pos % 3 == 1 and iwords[dig] or words[dig]) .. (pos % 3 == 2 and "hundred " or "")
×
42
      if level then
×
UNCOV
43
         name, level = name .. levels[math.floor(pos / 3)], false
×
44
      end
UNCOV
45
      return name
×
46
   end
47

UNCOV
48
   local vword = ""
×
49

50
   for i, v in digits(num) do
×
UNCOV
51
      vword = getname(i, v) .. vword
×
52
   end
53

54
   for i, v in ipairs(words) do
×
55
      vword = vword:gsub("ty " .. v, "ty-" .. v)
×
UNCOV
56
      vword = vword:gsub("ten " .. v, twords[i])
×
57
   end
58

UNCOV
59
   return num == 0 and "zero" or vword:sub(1, -2)
×
60
end
61

62
return language
153✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc