local i=require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\106\101\115\116-\103\108\111\098\097\108\115")local J=require("\046\046\047\099\104\097\114\097\099\116\101\114")local d=i.expect local k=i.it local H=i.beforeAll local l=20 local F H(function()F=J(Random.new())end)k("\114\101\116\117\114\110\115 \097 \118\097\108\105\100 \100\105\103\105\116",function()for i=1,l,1 do(d(F.digit())).toEqual(d.stringMatching("\094\091\048-\057\093\036"))end end)k("\114\101\116\117\114\110\115 \097 \118\097\108\105\100 \108\101\116\116\101\114",function()for i=1,l,1 do(d(F.letter())).toEqual(d.stringMatching("\094\091\097-\122\065-\090\093\036"))end end)k("\114\101\116\117\114\110\115 \097 \118\097\108\105\100 \108\111\119\101\114 \099\097\115\101 \108\101\116\116\101\114",function()for i=1,l,1 do(d(F.lowerCaseLetter())).toEqual(d.stringMatching("\094\091\097-\122\093\036"))end end)k("\114\101\116\117\114\110\115 \097 \118\097\108\105\100 \117\112\112\101\114 \099\097\115\101 \108\101\116\116\101\114",function()for i=1,l,1 do(d(F.upperCaseLetter())).toEqual(d.stringMatching("\094\091\065-\090\093\036"))end end)
local JestGlobals = require('@pkg/@jsdotlua/jest-globals')

local createCharacter = require('../character')

local expect = JestGlobals.expect
local it = JestGlobals.it
local beforeAll = JestGlobals.beforeAll

local FUZZ_COUNT = 20

local generator

beforeAll(function()
    generator = createCharacter(Random.new())
end)

it('returns a valid digit', function()
    for _ = 1, FUZZ_COUNT do
        expect(generator.digit()).toEqual(expect.stringMatching('^[0-9]$'))
    end
end)

it('returns a valid letter', function()
    for _ = 1, FUZZ_COUNT do
        expect(generator.letter()).toEqual(expect.stringMatching('^[a-zA-Z]$'))
    end
end)

it('returns a valid lower case letter', function()
    for _ = 1, FUZZ_COUNT do
        expect(generator.lowerCaseLetter()).toEqual(expect.stringMatching('^[a-z]$'))
    end
end)

it('returns a valid upper case letter', function()
    for _ = 1, FUZZ_COUNT do
        expect(generator.upperCaseLetter()).toEqual(expect.stringMatching('^[A-Z]$'))
    end
end)
