﻿package.path = ".\\?.lua;" .. package.path
package.cpath = ".\\?.dll;" .. package.cpath

crvmgr = require("test_c")
require("init")



el_test_num_table = {

{"1000000000000000000000000000000000000000000000000000000000000000000000000", "#3", "1000000000000000000000000000000000000000000000000000000000000000000000000"},
{"100000000000000000000000000000000000000000000000000000000000000000000000", "#3", "一千無量大数"},
{"10000000000000000000000000000000000000000000000000000000000000000000000", "#3", "百無量大数"},
{"1000000000000000000000000000000000000000000000000000000000000000000000", "#3", "十無量大数"},
{"100000000000000000000000000000000000000000000000000000000000000000000", "#3", "一無量大数"},
{"10000000000000000000000000000000000000000000000000000000000000000000", "#3", "一千不可思議"},
{"1000000000000000000000000000000000000000000000000000000000000000000", "#3", "百不可思議"},
{"100000000000000000000000000000000000000000000000000000000000000000", "#3", "十不可思議"},
{"10000000000000000000000000000000000000000000000000000000000000000", "#3", "一不可思議"},
{"1000000000000000000000000000000000000000000000000000000000000000", "#3", "一千那由他"},
{"100000000000000000000000000000000000000000000000000000000000000", "#3", "百那由他"},
{"10000000000000000000000000000000000000000000000000000000000000", "#3", "十那由他"},
{"1000000000000000000000000000000000000000000000000000000000000", "#3", "一那由他"},
{"100000000000000000000000000000000000000000000000000000000000", "#3", "一千阿僧祇"},
{"10000000000000000000000000000000000000000000000000000000000", "#3", "百阿僧祇"},
{"1000000000000000000000000000000000000000000000000000000000", "#3", "十阿僧祇"},
{"100000000000000000000000000000000000000000000000000000000", "#3", "一阿僧祇"},
{"10000000000000000000000000000000000000000000000000000000", "#3", "一千恒河沙"},
{"1000000000000000000000000000000000000000000000000000000", "#3", "百恒河沙"},
{"100000000000000000000000000000000000000000000000000000", "#3", "十恒河沙"},
{"10000000000000000000000000000000000000000000000000000", "#3", "一恒河沙"},
{"1000000000000000000000000000000000000000000000000000", "#3", "一千極"},
{"100000000000000000000000000000000000000000000000000", "#3", "百極"},
{"10000000000000000000000000000000000000000000000000", "#3", "十極"},
{"1000000000000000000000000000000000000000000000000", "#3", "一極"},
{"100000000000000000000000000000000000000000000000", "#3", "一千載"},
{"10000000000000000000000000000000000000000000000", "#3", "百載"},
{"1000000000000000000000000000000000000000000000", "#3", "十載"},
{"100000000000000000000000000000000000000000000", "#3", "一載"},
{"10000000000000000000000000000000000000000000", "#3", "一千正"},
{"1000000000000000000000000000000000000000000", "#3", "百正"},
{"100000000000000000000000000000000000000000", "#3", "十正"},
{"10000000000000000000000000000000000000000", "#3", "一正"},
{"1000000000000000000000000000000000000000", "#3", "一千澗"},
{"100000000000000000000000000000000000000", "#3", "百澗"},
{"10000000000000000000000000000000000000", "#3", "十澗"},
{"1000000000000000000000000000000000000", "#3", "一澗"},
{"100000000000000000000000000000000000", "#3", "一千溝"},
{"10000000000000000000000000000000000", "#3", "百溝"},
{"1000000000000000000000000000000000", "#3", "十溝"},
{"100000000000000000000000000000000", "#3", "一溝"},
{"10000000000000000000000000000000", "#3", "一千穣"},
{"1000000000000000000000000000000", "#3", "百穣"},
{"100000000000000000000000000000", "#3", "十穣"},
{"10000000000000000000000000000", "#3", "一穣"},
{"1000000000000000000000000000", "#3", "一千𥝱"},
{"100000000000000000000000000", "#3", "百𥝱"},
{"10000000000000000000000000", "#3", "十𥝱"},
{"1000000000000000000000000", "#3", "一𥝱"},
{"100000000000000000000000", "#3", "一千垓"},
{"10000000000000000000000", "#3", "百垓"},
{"1000000000000000000000", "#3", "十垓"},
{"100000000000000000000", "#3", "一垓"},
{"10000000000000000000", "#3", "一千京"},
{"1000000000000000000", "#3", "百京"},
{"100000000000000000", "#3", "十京"},
{"10000000000000000", "#3", "一京"},
{"1000000000000000", "#3", "一千兆"},
{"100000000000000", "#3", "百兆"},
{"10000000000000", "#3", "十兆"},
{"1000000000000", "#3", "一兆"},
{"100000000000", "#3", "一千億"},
{"10000000000", "#3", "百億"},
{"1000000000", "#3", "十億"},
{"100000000", "#3", "一億"},
{"10000000", "#3", "一千万"},
{"1000000", "#3", "百万"},
{"100000", "#3", "十万"},
{"10000", "#3", "一万"},
{"1000", "#3", "一千"},
{"100", "#3", "百"},
{"10", "#3", "十"},
{"1", "#3", "一"},
{"123456789012345678901234", "#3", "一千二百三十四垓五千六百七十八京九千十二兆三千四百五十六億七千八百九十万一千二百三十四"},
{"12345678901234567890123", "#3", "百二十三垓四千五百六十七京八千九百一兆二千三百四十五億六千七百八十九万百二十三"},
{"1234567890123456789012", "#3", "十二垓三千四百五十六京七千八百九十兆一千二百三十四億五千六百七十八万九千十二"},
{"123456789012345678901", "#3", "一垓二千三百四十五京六千七百八十九兆百二十三億四千五百六十七万八千九百一"},
{"12345678901234567890", "#3", "一千二百三十四京五千六百七十八兆九千十二億三千四百五十六万七千八百九十"},
{"1234567890123456789", "#3", "百二十三京四千五百六十七兆八千九百一億二千三百四十五万六千七百八十九"},
{"123456789012345678", "#3", "十二京三千四百五十六兆七千八百九十億一千二百三十四万五千六百七十八"},
{"12345678901234567", "#3", "一京二千三百四十五兆六千七百八十九億百二十三万四千五百六十七"},
{"1234567890123456", "#3", "一千二百三十四兆五千六百七十八億九千十二万三千四百五十六"},
{"123456789012345", "#3", "百二十三兆四千五百六十七億八千九百一万二千三百四十五"},
{"12345678901234", "#3", "十二兆三千四百五十六億七千八百九十万一千二百三十四"},
{"1234567890123", "#3", "一兆二千三百四十五億六千七百八十九万百二十三"},
{"123456789012", "#3", "一千二百三十四億五千六百七十八万九千十二"},
{"12345678901", "#3", "百二十三億四千五百六十七万八千九百一"},
{"123456789", "#3", "一億二千三百四十五万六千七百八十九"},
{"12345678", "#3", "一千二百三十四万五千六百七十八"},
{"1234567", "#3", "百二十三万四千五百六十七"},
{"123456", "#3", "十二万三千四百五十六"},
{"12345", "#3", "一万二千三百四十五"},
{"1234", "#3", "一千二百三十四"},
{"123", "#3", "百二十三"},
{"12", "#3", "十二"},
{"1", "#3", "一"},
{"0", "#3", "〇"},
{"1000000000000000000000000000000000000000000000000000000000000000000000000", "#5", "1000000000000000000000000000000000000000000000000000000000000000000000000"},
{"100000000000000000000000000000000000000000000000000000000000000000000000", "#5", "壱千無量大数"},
{"10000000000000000000000000000000000000000000000000000000000000000000000", "#5", "百無量大数"},
{"1000000000000000000000000000000000000000000000000000000000000000000000", "#5", "拾無量大数"},
{"100000000000000000000000000000000000000000000000000000000000000000000", "#5", "壱無量大数"},
{"10000000000000000000000000000000000000000000000000000000000000000000", "#5", "壱千不可思議"},
{"1000000000000000000000000000000000000000000000000000000000000000000", "#5", "百不可思議"},
{"100000000000000000000000000000000000000000000000000000000000000000", "#5", "拾不可思議"},
{"10000000000000000000000000000000000000000000000000000000000000000", "#5", "壱不可思議"},
{"1000000000000000000000000000000000000000000000000000000000000000", "#5", "壱千那由他"},
{"100000000000000000000000000000000000000000000000000000000000000", "#5", "百那由他"},
{"10000000000000000000000000000000000000000000000000000000000000", "#5", "拾那由他"},
{"1000000000000000000000000000000000000000000000000000000000000", "#5", "壱那由他"},
{"100000000000000000000000000000000000000000000000000000000000", "#5", "壱千阿僧祇"},
{"10000000000000000000000000000000000000000000000000000000000", "#5", "百阿僧祇"},
{"1000000000000000000000000000000000000000000000000000000000", "#5", "拾阿僧祇"},
{"100000000000000000000000000000000000000000000000000000000", "#5", "壱阿僧祇"},
{"10000000000000000000000000000000000000000000000000000000", "#5", "壱千恒河沙"},
{"1000000000000000000000000000000000000000000000000000000", "#5", "百恒河沙"},
{"100000000000000000000000000000000000000000000000000000", "#5", "拾恒河沙"},
{"10000000000000000000000000000000000000000000000000000", "#5", "壱恒河沙"},
{"1000000000000000000000000000000000000000000000000000", "#5", "壱千極"},
{"100000000000000000000000000000000000000000000000000", "#5", "百極"},
{"10000000000000000000000000000000000000000000000000", "#5", "拾極"},
{"1000000000000000000000000000000000000000000000000", "#5", "壱極"},
{"100000000000000000000000000000000000000000000000", "#5", "壱千載"},
{"10000000000000000000000000000000000000000000000", "#5", "百載"},
{"1000000000000000000000000000000000000000000000", "#5", "拾載"},
{"100000000000000000000000000000000000000000000", "#5", "壱載"},
{"10000000000000000000000000000000000000000000", "#5", "壱千正"},
{"1000000000000000000000000000000000000000000", "#5", "百正"},
{"100000000000000000000000000000000000000000", "#5", "拾正"},
{"10000000000000000000000000000000000000000", "#5", "壱正"},
{"1000000000000000000000000000000000000000", "#5", "壱千澗"},
{"100000000000000000000000000000000000000", "#5", "百澗"},
{"10000000000000000000000000000000000000", "#5", "拾澗"},
{"1000000000000000000000000000000000000", "#5", "壱澗"},
{"100000000000000000000000000000000000", "#5", "壱千溝"},
{"10000000000000000000000000000000000", "#5", "百溝"},
{"1000000000000000000000000000000000", "#5", "拾溝"},
{"100000000000000000000000000000000", "#5", "壱溝"},
{"10000000000000000000000000000000", "#5", "壱千穣"},
{"1000000000000000000000000000000", "#5", "百穣"},
{"100000000000000000000000000000", "#5", "拾穣"},
{"10000000000000000000000000000", "#5", "壱穣"},
{"1000000000000000000000000000", "#5", "壱千𥝱"},
{"100000000000000000000000000", "#5", "百𥝱"},
{"10000000000000000000000000", "#5", "拾𥝱"},
{"1000000000000000000000000", "#5", "壱𥝱"},
{"100000000000000000000000", "#5", "壱千垓"},
{"10000000000000000000000", "#5", "百垓"},
{"1000000000000000000000", "#5", "拾垓"},
{"100000000000000000000", "#5", "壱垓"},
{"10000000000000000000", "#5", "壱千京"},
{"1000000000000000000", "#5", "百京"},
{"100000000000000000", "#5", "拾京"},
{"10000000000000000", "#5", "壱京"},
{"1000000000000000", "#5", "壱千兆"},
{"100000000000000", "#5", "百兆"},
{"10000000000000", "#5", "拾兆"},
{"1000000000000", "#5", "壱兆"},
{"100000000000", "#5", "壱千億"},
{"10000000000", "#5", "百億"},
{"1000000000", "#5", "拾億"},
{"100000000", "#5", "壱億"},
{"10000000", "#5", "壱千万"},
{"1000000", "#5", "百万"},
{"100000", "#5", "拾万"},
{"10000", "#5", "壱万"},
{"1000", "#5", "壱千"},
{"100", "#5", "百"},
{"10", "#5", "拾"},
{"1", "#5", "壱"},
{"125456789012345678901234", "#5", "壱千弐百五拾四垓五千六百七拾八京九千拾弐兆参千四百五拾六億七千八百九拾万壱千弐百参拾四"},
{"12345678901234567890123", "#5", "百弐拾参垓四千五百六拾七京八千九百壱兆弐千参百四拾五億六千七百八拾九万百弐拾参"},
{"1234567890123456789012", "#5", "拾弐垓参千四百五拾六京七千八百九拾兆壱千弐百参拾四億五千六百七拾八万九千拾弐"},
{"123456789012345678901", "#5", "壱垓弐千参百四拾五京六千七百八拾九兆百弐拾参億四千五百六拾七万八千九百壱"},
{"12345678901234567890", "#5", "壱千弐百参拾四京五千六百七拾八兆九千拾弐億参千四百五拾六万七千八百九拾"},
{"1234567890123456789", "#5", "百弐拾参京四千五百六拾七兆八千九百壱億弐千参百四拾五万六千七百八拾九"},
{"123456789012345678", "#5", "拾弐京参千四百五拾六兆七千八百九拾億壱千弐百参拾四万五千六百七拾八"},
{"12345678901234567", "#5", "壱京弐千参百四拾五兆六千七百八拾九億百弐拾参万四千五百六拾七"},
{"1234567890123456", "#5", "壱千弐百参拾四兆五千六百七拾八億九千拾弐万参千四百五拾六"},
{"123456789012345", "#5", "百弐拾参兆四千五百六拾七億八千九百壱万弐千参百四拾五"},
{"12345678901234", "#5", "拾弐兆参千四百五拾六億七千八百九拾万壱千弐百参拾四"},
{"1234567890123", "#5", "壱兆弐千参百四拾五億六千七百八拾九万百弐拾参"},
{"123456789012", "#5", "壱千弐百参拾四億五千六百七拾八万九千拾弐"},
{"12345678901", "#5", "百弐拾参億四千五百六拾七万八千九百壱"},
{"123456789", "#5", "壱億弐千参百四拾五万六千七百八拾九"},
{"12345678", "#5", "壱千弐百参拾四万五千六百七拾八"},
{"1234567", "#5", "百弐拾参万四千五百六拾七"},
{"123456", "#5", "拾弐万参千四百五拾六"},
{"12345", "#5", "壱万弐千参百四拾五"},
{"1234", "#5", "壱千弐百参拾四"},
{"123", "#5", "百弐拾参"},
{"12", "#5", "拾弐"},
{"1", "#5", "壱"},
{"0", "#5", "零"},
{"9876543210", "#0", "9876543210"},
{"9876543210", "#1", "９８７６５４３２１０"},
{"9876543210", "#2", "九八七六五四三二一〇"},
{"9", "#8", "9"},
{"98", "#8", "98"},
{"987", "#8", "987"},
{"9876", "#8", "9,876"},
{"98765", "#8", "98,765"},
{"987654", "#8", "987,654"},
{"9876543", "#8", "9,876,543"},
{"98765432", "#8", "98,765,432"},
{"987654321", "#8", "987,654,321"},
{"9876543210", "#8", "9,876,543,210"},
{"98765432109", "#8", "98,765,432,109"},
{"987654321098", "#8", "987,654,321,098"},
{"9876543210987", "#8", "9,876,543,210,987"},
{"98765432109876", "#8", "98,765,432,109,876"},
{"98", "#9", "９八"},
{"141", "#9", "141"},
{"1000000000001", "#3", "一兆一"},
{"10000000000001", "#3", "十兆一"},
{"100000000000001", "#3", "百兆一"},
{"1000000000000001", "#3", "一千兆一"},
{"24", "#6", "XXIV"},
{"48", "#6", "XLVIII"},
{"495", "#6", "CDXCV"},
{"1888", "#6", "MDCCCLXXXVIII"},
{"2444", "#6", "MMCDXLIV"},
{"3999", "#6", "MMMCMXCIX"},
{"p125", "#4", "東京都葛飾区"},

}



local result = "OK"

for i, v in ipairs(el_test_num_table) do
	print("<= \"" .. v[1] .. "\" \"".. v[2] .. "\"")
	local s = lua_skk_convert_candidate(v[1], v[2], "")

	if (s) then
		if (s == "") then
			s = v[2]
		end
		print("=> \"" .. s .. "\"")
	else
		print("=> nil")
	end

	if (v[3]) then
		if (type(v[3]) == "function") then
			v[3] = v[3](s)
		end

		if (tostring(s) == v[3]) then
			print "OK\n"
		else
			result = "NG"
			print("== " .. v[3] .. "\n" .. result)
			break
		end
	else
		print("\n")
	end
end

if (result == "OK") then
	print("\nAll OK.")
end
