FANDOM


-- starshipcodes/testcases module
-- inside: [[Category:Modules]] using this line once...
 
-- Unit tests for [[Module:Starshipcodes]]. Click talk page to run tests.
local p = require('Dev:UnitTests')
 
local ans1 =        'CommonCodes bad-which :'
local ans2 =        'invalid sorc-value >>'
local ans3 =        'glbls.args={ [1] = s,'
local ans4 =        'main-fail'
 
function p:test_hello()
    self:preprocess_equals('{{#invoke:Starshipcodes | hello}}', 'Hello, world!')
end
 
function p:test_nonmains()
    self:preprocess_equals('{{#invoke:Starshipcodes | codename | SGZ }}', 'stargazer-3')
--    self:preprocess_equals('{{#invoke:Starshipcodes | dumpInfobox | SGZ }}', 'stargazer-3')
--    self:preprocess_equals('{{#invoke:Starshipcodes | getSkills | SGZ }}', 'stargazer-3')
end
 
function p:test_names()
    self:preprocess_equals('{{#invoke:Starshipcodes | main | SGZ }}', '[[Stargazer]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | END }}', '[[Next Enterprise]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | TS }}', '[[Tsiolkovsky]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | BC1 }}', '[[Cube 1]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | BC2 }}', '[[Cube 2]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | CG }}', '[[Galor]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | CH }}', '[[Hideki]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | FDM }}', '[[Marauder]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KNV }}', '[[Negh\'var]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KV }}', '[[Ship-Vor\'Cha]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | RDD }}', '[[D\'deridex]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | RS }}', '[[Scout]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | ENA }}', '[[Enterprise A]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | ENB }}', '[[Enterprise B]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | EN }}', '[[Original Enterprise]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | HOZ }}', '[[Horizon]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | REL }}', '[[Reliant]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KBP }}', '[[Klingon bop]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KEB }}', '[[Early bop]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KKT }}', '[[K\'Tinga]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | KR }}', '[[Raptor]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | RBP }}', '[[Romulan bop]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | RD7 }}', '[[D-7]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | RV7 }}', '[[V-7]]')
end
 
function p:test_listShips()
    --- note: spaces are important for exactness...
    self:preprocess_equals('{{#invoke:Starshipcodes | main | list | SGZ }}', 'Lists must be in name,number pairs')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | list | SGZ | 1 }}', '1 [[Stargazer]] ')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | list | SGZ | -1.250 }}', '-1.250 [[Stargazer]] ')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | list | SGZ | 2 | END | 4}}', '2 [[Stargazer]]  and 4 [[Next Enterprise]] ')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | list | SGZ | 2 | END | 4 | BC1 | 3 }}', '2 [[Stargazer]] , 4 [[Next Enterprise]] , and 3 [[Cube 1]] ')
end
 
local blnkDump = '{ ["aenu"] = ,["ag"] = ,["aliases"] = ,["ar"] = ,["aw"] = ,["cargo"] = { ["crewamt"] = ,["crmax"] = ,["crmin"] = ,["crtyp"] = ,["weaponamt"] = ,["wpmax"] = ,["wpmin"] = ,["wptyp"] = ,} ,["cargoUpgrades"] = { ["cupgr1"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr10"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr11"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr12"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr13"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr14"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr15"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr16"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr2"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr3"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr4"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr5"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr6"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr7"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr8"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,["cupgr9"] = { ["crewamt"] = ,["currentlevel"] = ,["weaponamt"] = ,} ,} ,["currentlevel"] = ,["govt"] = ,["hp"] = ,["igp"] = ,["image"] = ,["imagecaption"] = ,["limit"] = ,["lmax"] = ,["lmin"] = ,["name"] = ,["nup"] = ,["othersUpgrades"] = { ["up03"] = { ["ag"] = ,["ar"] = ,["aw"] = ,["currentlevel"] = 50,["hp"] = ,["skillschosen"] = 1o1y1b,} ,["up09"] = { ["ag"] = ,["ar"] = ,["aw"] = ,["currentlevel"] = 96,["hp"] = ,["skillschosen"] = 3o3y3b,} ,["up10"] = { ["ag"] = ,["ar"] = ,["aw"] = ,["currentlevel"] = 50,["hp"] = ,["skillschosen"] = 5o5y0b,} ,["up15"] = { ["ag"] = ,["ar"] = ,["aw"] = ,["currentlevel"] = 95,["hp"] = ,["skillschosen"] = 5o5y5b,} ,} ,["sdate"] = ,["series"] = ,["skills"] = { ["color1"] = ,["color2"] = ,["color3"] = ,["cost1"] = ,["cost2"] = ,["cost3"] = ,["desc1"] = { ["t1"] = ,["t2"] = ,["t3"] = ,["t4"] = ,["t5"] = ,["t6"] = ,["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc2"] = { ["t1"] = ,["t2"] = ,["t3"] = ,["t4"] = ,["t5"] = ,["t6"] = ,["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc3"] = { ["t1"] = ,["t2"] = ,["t3"] = ,["t4"] = ,["t5"] = ,["t6"] = ,["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["skill1"] = ,["skill2"] = ,["skill3"] = ,} ,["skillsUpgrades"] = { ["supgr2"] = { ["cost1"] = ,["cost2"] = ,["cost3"] = ,["desc1"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc2"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc3"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,} ,["supgr3"] = { ["cost1"] = ,["cost2"] = ,["cost3"] = ,["desc1"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc2"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc3"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,} ,["supgr4"] = { ["cost1"] = ,["cost2"] = ,["cost3"] = ,["desc1"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc2"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc3"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,} ,["supgr5"] = { ["cost1"] = ,["cost2"] = ,["cost3"] = ,["desc1"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc2"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,["desc3"] = { ["v1"] = ,["v2"] = ,["v3"] = ,["v4"] = ,["v5"] = ,} ,} ,} ,["tier"] = ,["xnpc"] = , } '
local sgzDump = '{ ["aenu"] = Ally,["ag"] = +23,["aliases"] = USS Stargazer,["ar"] = +27,["aw"] = +23,["cargo"] = { ["crewamt"] = 2,["crmax"] = 8,["crmin"] = 0,["crtyp"] = tbd = any, universal, federation, klingon, romulan,["weaponamt"] = 2,["wpmax"] = 8,["wpmin"] = 0,["wptyp"] = tbd = any, universal, federation, klingon, romulan,} ,["cargoUpgrades"] = { ["cupgr1"] = { ["crewamt"] = 2,["currentlevel"] = 55,["weaponamt"] = 3,} ,["cupgr2"] = { ["crewamt"] = 3,["currentlevel"] = 65,["weaponamt"] = 3,} ,["cupgr3"] = { ["crewamt"] = 3,["currentlevel"] = 75,["weaponamt"] = 4,} ,["cupgr4"] = { ["crewamt"] = 4,["currentlevel"] = 85,["weaponamt"] = 4,} ,["cupgr5"] = { ["crewamt"] = 4,["currentlevel"] = 95,["weaponamt"] = 5,} ,["cupgr6"] = { ["crewamt"] = 5,["currentlevel"] = 105,["weaponamt"] = 5,} ,["cupgr7"] = { ["crewamt"] = 5,["currentlevel"] = 115,["weaponamt"] = 6,} ,["cupgr8"] = { ["crewamt"] = 6,["currentlevel"] = 125,["weaponamt"] = 6,} ,["cupgr9"] = { ["crewamt"] = 6,["currentlevel"] = 135,["weaponamt"] = 7,} ,["cupgrx"] = { ["crewamt"] = 7,["currentlevel"] = 145,["weaponamt"] = 7,} ,["cupgry"] = { ["crewamt"] = 7,["currentlevel"] = 155,["weaponamt"] = 8,} ,["cupgrz"] = { ["crewamt"] = 8,["currentlevel"] = 165,["weaponamt"] = 8,} ,} ,["currentlevel"] = 40,["govt"] = [[Federation]],["hp"] = 1228,["igp"] = stargazer,["image"] = Stargazer-3.png,["imagecaption"] = USS Stargazer,["limit"] = 165,["lmax"] = 42,["lmin"] = 40,["name"] = [[Stargazer]],["nup"] = 15,["othersUpgrades"] = { ["up03"] = { ["ag"] = +28,["ar"] = +32,["aw"] = +28,["currentlevel"] = 50,["hp"] = 1518,["skillschosen"] = 2o1y0b,} ,["up09XXX"] = { ["ag"] = +12,["ar"] = +12,["aw"] = +12,["currentlevel"] = 96,["hp"] = 1500,["skillschosen"] = 3o3y3b,} ,["up15XXX"] = { ["ag"] = +35,["ar"] = +35,["aw"] = +35,["currentlevel"] = 165,["hp"] = 3500,["skillschosen"] = 5o5y5b,} ,} ,["sdate"] = 2015-01-01,["series"] = TNG,["skills"] = { ["color1"] = Orange,["color2"] = Yellow,["color3"] = Blue,["cost1"] = 9,["cost2"] = passive,["cost3"] = 7,["desc1"] = { ["t1"] = Changes ,["t2"] = blue gems to strike. Does ,["t3"] = damage for each orange gem that the team has. Max ,["t4"] = .,["v1"] = 2,["v2"] = 32,["v3"] = 170,} ,["desc2"] = { ["t1"] = If you have less than ,["t2"] = % life remaining, each strike will cause a damage of ,["t3"] = , for each yellow gem on the board. Max ,["t4"] = .,["v1"] = 10,["v2"] = 17,["v3"] = 170,} ,["desc3"] = { ["t1"] = Repairs the shield by ,["t2"] = and adds ,["t3"] = defensive gems that protext ,["t4"] = life during each turn.,["v1"] = 50,["v2"] = 2,["v3"] = 18,} ,["skill1"] = Constellation Class,["skill2"] = Picard Maneuver,["skill3"] = Skirmish,} ,["skillsUpgrades"] = { ["supgr2"] = { ["desc1"] = { ["v1"] = 31,["v2"] = 48,["v3"] = 250,} ,["desc2"] = { ["v2"] = 21,["v3"] = 210,} ,["desc3"] = { ["v1"] = 70,["v3"] = 24,} ,} ,["supgr3"] = { ["desc1"] = { ["v1"] = 31,["v2"] = 55,["v3"] = 300,} ,["desc2"] = { ["v2"] = 29,["v3"] = 290,} ,["desc3"] = { ["v1"] = 86,["v3"] = 36,} ,} ,["supgr4"] = { ["desc1"] = { ["v1"] = 4,["v2"] = 68,["v3"] = 360,} ,["desc2"] = { ["v2"] = 37,["v3"] = 370,} ,["desc3"] = { ["v1"] = 108,["v3"] = 44,} ,} ,["supgr5"] = { ["desc1"] = { ["v1"] = 5,["v2"] = 78,["v3"] = 420,} ,["desc2"] = { ["v2"] = 41,["v3"] = 410,} ,["desc3"] = { ["v1"] = 122,["v3"] = 50,} ,} ,} ,["tier"] = 3,["xnpc"] = yes,} '
 
function p:test_oddmains()
    self:preprocess_equals('{{#invoke:Starshipcodes | main }}', ans4)
--    self:preprocess_equals('{{#invoke:Starshipcodes | main }}', 'tbd...')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | ZZZZ | SGZ }}', ans1..ans3..'[2] = ZZZZ,[3] = SGZ,} ')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | blank }}', 'tbd...')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | blank | SGZ }}', ans1..ans3..'[2] = blank,[3] = SGZ,} ')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | blank | SGZ }}', blnkDump)
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | full | SGZ }}', sgzDump)
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | dumpGLBL | SGZ }}', 'TEST-dumpGLBL')
end
 
function p:test_skills()
--    self:preprocess_equals('{{#invoke:Starshipcodes | skills | XXX }}', 'skills-fail...')
    self:preprocess_equals('{{#invoke:Starshipcodes | skills | XXX }}', 'false')
    self:preprocess_equals('{{#invoke:Starshipcodes | skills | SGZ }}', 'JSON-encoded-data')
end
 
--[[
function p:test_TBLs_all()
    self:preprocess_equals('{{#invoke:Starshipcodes | showTBLs | XXX }}', 'showTBLs-fail...')
    self:preprocess_equals('{{#invoke:Starshipcodes | showTBLs | SGZ }}', 'JSON-encoded-data')
end
--]]
 
function p:test_singlemains()
    self:preprocess_equals('{{#invoke:Starshipcodes | main | n | SGZ }}', '[[Stargazer]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | name | SGZ }}', '[[Stargazer]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | hp | SGZ }}', '1228')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | i | SGZ }}', 'Stargazer.png')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | icon | SGZ }}', 'Stargazer.png')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | image | SGZ }}', 'Stargazer.png')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | s | SGZ }}', 'TNG')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | series | SGZ }}', 'TNG')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | t | SGZ }}', '3')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | tier | SGZ }}', '3')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | g | SGZ }}', '[[Federation]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | govt | SGZ }}', '[[Federation]]')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | aliases | SGZ }}', 'USS Stargazer')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | igp | SGZ }}', 'stargazer')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | xnpc | SGZ }}', 'yes')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | sdate | SGZ }}', '2015-01-01')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | aenu | SGZ }}', 'Ally')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | lmin | SGZ }}', '40')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | lmax | SGZ }}', '42')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | limit | SGZ }}', '165')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | nup | SGZ }}', '15')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | skills | SGZ }}', '???')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | skill1 | SGZ }}', '???')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | ar | SGZ }}', '+27')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | ag | SGZ }}', '+23')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | aw | SGZ }}', '+23')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | cargo | SGZ }}', '???')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | crewamt | SGZ }}', '???')
    self:preprocess_equals('{{#invoke:Starshipcodes | main | currentlevel | SGZ }}', '40')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | skillsUpgrades | SGZ }}', '???')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | supgr2 | SGZ }}', '???')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | othersUpgrades | SGZ }}', '???')
--    self:preprocess_equals('{{#invoke:Starshipcodes | main | cargoUpgrades | SGZ }}', '???')
end
 
local STARSHIPBLANK = {
		name = ' ',
		aliases = ' ',
		image = ' ',
		imagecaption = ' ',
		igp = ' ',
		tier = ' ',
		series = ' ',
		govt = ' ',
		xnpc = ' ',
		sdate = ' ',
		aenu = ' ',
		lmin = ' ',
		lmax = ' ',
		limit = ' ',
		hp = ' ',
		nup = ' ',
		skills = {
    		skill1 = ' ',
	    	color1 = ' ',
		    cost1 = ' ',
    		desc1 = { t1 = ' ', v1 = ' ', t2 = ' ', v2 = ' ', 
    		        t3 = ' ', v3 = ' ', t4 = ' ', v4 = ' ',
                    t5 = ' ', v5 = ' ', t6 = ' ', },
    		skill2 = ' ',
	    	color2 = ' ',
		    cost2 = ' ',
    		desc2 = { t1 = ' ', v1 = ' ', t2 = ' ', v2 = ' ', 
    		        t3 = ' ', v3 = ' ', t4 = ' ', v4 = ' ',
                    t5 = ' ', v5 = ' ', t6 = ' ', },
    		skill3 = ' ',
	    	color3 = ' ',
		    cost3 = ' ',
    		desc3 = { t1 = ' ', v1 = ' ', t2 = ' ', v2 = ' ', 
    		        t3 = ' ', v3 = ' ', t4 = ' ', v4 = ' ',
                    t5 = ' ', v5 = ' ', t6 = ' ', },
		},
		ar = ' ',
		ag = ' ',
		aw = ' ',
		cargo = { 
		    crewamt = ' ',
		    crmin = ' ',
		    crmax = ' ',
		    crtyp = ' ',
		    weaponamt = ' ',
		    wpmin = ' ',
		    wpmax = ' ',
		    wptyp = ' ',
		},
		currentlevel = ' ',
		skillsUpgrades = {
		    supgr2 = { 
		        cost1 = ' ', cost2 = ' ', cost3 = ' ', 
		      desc1 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc2 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc3 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      },
		    supgr3 = { 
		        cost1 = ' ', cost2 = ' ', cost3 = ' ', 
		      desc1 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc2 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc3 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      },
		    supgr4 = { 
		        cost1 = ' ', cost2 = ' ', cost3 = ' ', 
		      desc1 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc2 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc3 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      },
		    supgr5 = { 
		        cost1 = ' ', cost2 = ' ', cost3 = ' ', 
		      desc1 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc2 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      desc3 = { v1 = ' ', v2 = ' ', v3 = ' ', v4 = ' ', v5 = ' ', },
		      },
		},
		othersUpgrades = {
		    up03 = { currentlevel = 50, skillschosen = '1o1y1b',
                        -- tier-3/4 matching tier-1-max
		            hp = ' ', ar = ' ', ag = ' ', aw = ' ',
		      },
		    up09 = { currentlevel = 96, skillschosen = '3o3y3b',
                        -- tier-3/4 almost-matching tier-2-max
		            hp = ' ', ar = ' ', ag = ' ', aw = ' ',
		      },
		    up10 = { currentlevel = 50, skillschosen = '5o5y0b',
                        -- tier-1-max
                        -- tier-2 matching tier-1-max
		            hp = ' ', ar = ' ', ag = ' ', aw = ' ',
		      },
		    up15 = { currentlevel = 95, skillschosen = '5o5y5b',
                        -- tier-2-max
                        -- tier-3/4-max is lvl-165
		            hp = ' ', ar = ' ', ag = ' ', aw = ' ',
		      },
		},
		cargoUpgrades = {
		    cupgr1 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr2 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr3 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr4 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr5 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr6 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr7 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr8 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr9 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr10 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr11 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr12 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr13 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr14 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr15 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
		    cupgr16 = { currentlevel = ' ', crewamt = ' ', weaponamt = ' ', },
	    },
}
 
--[[
 
function p:test_readargs()
    --- note: spaces are important for exactness...
    self:preprocess_equals('{{#invoke:Charactercodes | readargs}}', '{ } ')
    self:preprocess_equals('{{#invoke:Charactercodes | readargs | CK}}', '{ [1] = CK,} ')
end
 
function p:test_loadcrew()
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew}}', 'Empty Crew choice...>nil<...')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | ZZZZ}}', 'Unknown Crew member...>ZZZZ<...')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | 7}}', 'Unknown Crew member...>7<...')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | CK}}', 'Loaded...>CK<... as CO-CK')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | AK}}', 'Loaded...>AK<... as CO-AK')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | B1}}', 'Loaded...>B1<... as CN-B1')
    self:preprocess_equals('{{#invoke:Charactercodes | loadcrew | aaaaDEFAULT }}', 'Loaded...>aaaaDEFAULT<... as CO-aaaaDEFAULT')
end
 
function p:test_igpt()
    self:preprocess_equals('{{#invoke:Charactercodes | codename | CK}}', 'kirk-1')
    self:preprocess_equals('{{#invoke:Charactercodes | codename | AK}}', 'kirk-2')
    self:preprocess_equals('{{#invoke:Charactercodes | codename | aaaaDEFAULT}}', 'default-1')
end
 
function p:test_skills_errors()
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK}}', 'not-useful-expansion for createSkillsString...')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1}}', 'not-useful-expansion for createSkillsString...')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|0}}', 'not-useful-expansion for createSkillsString...')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|5|1}}', 'bad Skillnum=5')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | PC|3|1}}', 'bad Skillnum=3')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|6}}', 'bad SkillUpgrade=6')
end
 
 
function p:test_skills_ok()
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|1}}', 'Does 63 damage to the selected enemy.  Changes 3 random gems to yellow.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|2}}', 'Does 95 damage to the selected enemy.  Changes 4 random gems to yellow.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|3}}', 'Does 126 damage to the selected enemy.  Changes 4 random gems to yellow.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|4}}', 'Does 151 damage to the selected enemy.  Changes 5 random gems to yellow.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|1|5}}', 'Does 168 damage to the selected enemy.  Changes 5 random gems to yellow.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|2|1}}', 'Does 125 damage to the selected enemy.  Changes 5 random gems to blue.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|2|2}}', 'Does 170 damage to the selected enemy.  Changes 6 random gems to blue.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|2|3}}', 'Does 205 damage to the selected enemy.  Changes 6 random gems to blue.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|2|4}}', 'Does 255 damage to the selected enemy.  Changes 7 random gems to blue.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|2|5}}', 'Does 303 damage to the selected enemy.  Changes 7 random gems to blue.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|3|1}}', 'Does 125 damage to the selected enemy and 75 to his allies.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|3|2}}', 'Does 170 damage to the selected enemy and 95 to his allies.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|3|3}}', 'Does 230 damage to the selected enemy and 118 to his allies.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|3|4}}', 'Does 295 damage to the selected enemy and 143 to his allies.')
    self:preprocess_equals('{{#invoke:Charactercodes | createSkillsString | CK|3|5}}', 'Does 345 damage to the selected enemy and 195 to his allies.')
end
 
local currentCodes = '{ [1] = anita-1,[2] = armus-2,[3] = beverly-1,[4] = beverly-2,[5] = borg-1-2,[6] = borg-2-2,[7] = borg-3-3,[8] = borg-4-3,[9] = borja-1,[10] = carlos-1,[11] = chekov-1,[12] = chekov-2,[13] = clayton-1-2,[14] = danimetal-1,[15] = data-1,[16] = data-2,[17] = entellan-tataur-3,[18] = entellan-tenva-3,[19] = entellan-tolkir-2,[20] = entellan-tonak-2,[21] = flopez-1-2,[22] = fonsi-1-2,[23] = francis-1-2,[24] = helmet-1,[25] = horta-2,[26] = human-antonio-2,[27] = ivan-total-1,[28] = jorge-2,[29] = khan-3,[30] = kirk-1,[31] = kirk-2,[32] = klingon-kurn-3,[33] = laforge-1,[34] = laforge-2,[35] = mccoy-1,[36] = mccoy-2,[37] = mhigueras-1,[38] = mordi-1,[39] = nodroz-1,[40] = pablo-1,[41] = picard-1,[42] = picard-2,[43] = q-3,[44] = riker-1,[45] = riker-2,[46] = romulan-antonio-2,[47] = ruk-2,[48] = sandra-1,[49] = scott-1,[50] = scott-2,[51] = spock-1,[52] = spock-2,[53] = sulu-1,[54] = sulu-2,[55] = talosian-keeper-3-4,[56] = tarr-2,[57] = tng-antican-2,[58] = tng-selay-2,[59] = tos-gorn-3,[60] = tos-human-alvaro-2,[61] = tos-m113-2,[62] = tos-masked-2-1,[63] = tos-masked-3-1,[64] = tos-pnj-10-alberto-1,[65] = tos-pnj-11-alejandro-2,[66] = tos-pnj-12-masked-boss-2,[67] = tos-pnj-2-bad-1,[68] = tos-pnj-3-boss-2,[69] = tos-pnj-4-mask-1,[70] = tos-pnj-7-ivan-2,[71] = tos-pnj-9-cigarrito-1,[72] = troi-1,[73] = troi-2,[74] = uhura-1,[75] = uhura-2,[76] = uhura-4,[77] = worf-1,[78] = worf-2,[79] = worf-3,} '
local currentKeys = '{ [1] = AH,[2] = AK,[3] = AM,[4] = ANU,[5] = AP,[6] = AR,[7] = ASP,[8] = AV,[9] = B1,[10] = B2,[11] = B3,[12] = B4,[13] = BA,[14] = BD,[15] = BE,[16] = CA,[17] = CAV,[18] = CBC,[19] = CDA,[20] = CDR,[21] = CH,[22] = CHS,[23] = CK,[24] = CLF,[25] = CLM,[26] = CMS,[27] = CNU,[28] = CP,[29] = CR,[30] = CT,[31] = CWF,[32] = CWR,[33] = DA,[34] = DE,[35] = DM,[36] = EK,[37] = HE,[38] = HO,[39] = HS,[40] = HV,[41] = IN,[42] = KG,[43] = KN,[44] = KO,[45] = KU,[46] = LB,[47] = LD,[48] = LE,[49] = LF,[50] = LPC,[51] = MS,[52] = NL,[53] = NO,[54] = NU,[55] = OP,[56] = PC,[57] = PG,[58] = PP,[59] = QQ,[60] = RU,[61] = SF,[62] = SG,[63] = SP,[64] = SS,[65] = SV,[66] = SWF,[67] = TA,[68] = TE,[69] = TH,[70] = TK,[71] = TK50,[72] = TN,[73] = TO,[74] = TR,[75] = TT,[76] = TV,[77] = VE,[78] = WF,[79] = WS,} '
 
function p:test_listall()
    self:preprocess_equals('{{#invoke:Charactercodes | listkeys }}', currentKeys)
    self:preprocess_equals('{{#invoke:Charactercodes | listcodes }}', currentCodes)
end
 
function p:test_expand()
    self:preprocess_equals('{{#invoke:Charactercodes | expand }}', '')
end
 
--]]
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.