Module:ConvertIB/testcases
Appearance
| This is the test cases page for the module Module:ConvertIB. Results of the test cases. |
-- Unit tests for [[Module:ConvertIB]]. Click talk page to run tests.
local p = require('Module:UnitTests')
local function convert_tester(tester,sandbox)
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|100|m2||sqft}}',
'{{Convert|100|m2|sqft|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||m2|100|sqft}}',
'{{Convert|100|sqft|m2|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|1000|m||ft}}',
'{{Convert|1000|m|ft|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||m|1000|ft}}',
'{{Convert|1000|ft|m|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|100|km/h||mph}}',
'{{Convert|100|km/h|mph|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||km/h|100|mph}}',
'{{Convert|100|mph|km/h|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|1000|ha||acre}}',
'{{Convert|1000|ha|acre|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ha|1000|acre}}',
'{{Convert|1000|acre|ha|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|1000|km2||sqmi}}',
'{{Convert|1000|km2|sqmi|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||km2|1000|sqmi}}',
'{{Convert|1000|sqmi|km2|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|5|ft||in}}',
'{{Convert|5|ft|in|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ft|120|in}}',
'{{Convert|120|in|ft|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|375|ml||impoz||USoz}}',
'{{Convert|375|ml|impoz+USoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml|40|impoz||USoz}}',
'{{Convert|40|impoz|ml+USoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml||impoz|32|USoz}}',
'{{Convert|32|USoz|ml+impoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|180|cm||ft||in}}',
'{{Convert|180|cm|ftin|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||cm|5|ft||in}}',
'{{Convert|5|ft|0|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||cm||ft|120|in}}',
'{{Convert|120|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||cm|5|ft|6|in}}',
'{{Convert|5|ft|6|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ft||in|180|cm}}',
'{{Convert|180|cm|ftin|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|5|ft||in||cm}}',
'{{Convert|5|ft|0|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ft|120|in||cm}}',
'{{Convert|120|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|5|ft|6|in||cm}}',
'{{Convert|5|ft|6|in|cm|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|8.5|kg||lb||oz}}',
'{{Convert|8.5|kg|lboz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|4|lb|3|oz}}',
'{{Convert|4|lb|3|oz|kg|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|65|kg||st||lb}}',
'{{Convert|65|kg|lb+stlb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|10|st||lb}}',
'{{Convert|10|st|0|lb|kg+lb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|11|st||lb}}',
'{{Convert|11|st|0|lb|kg+lb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|10|st|7|lb}}',
'{{Convert|10|st|7|lb|kg+lb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg||st|145|lb}}',
'{{Convert|145|lb|kg+stlb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|65|kg|10|st||lb}}',
'{{Convert|65|kg|lb+stlb|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||m2||sqft}}', '')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml||impoz||USoz}}', '')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|100|m2|100|sqft}}',
'{{Convert|100|m2|sqft|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|375|ml|40|impoz||USoz}}',
'{{Convert|375|ml|impoz+USoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|375|ml||impoz|32|USoz}}',
'{{Convert|375|ml|impoz+USoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml|40|impoz|32|USoz}}',
'{{Convert|40|impoz|ml+USoz|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|100|m2||sqft|4}}',
'{{Convert|100|m2|sqft|4|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|100|m2||sqft|sigfig=4}}',
'{{Convert|100|m2|sqft|sigfig=4|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml|40|impoz||USoz|2}}',
'{{Convert|40|impoz|ml+USoz|2|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||ml|40|impoz||USoz|sigfig=3}}',
'{{Convert|40|impoz|ml+USoz|sigfig=3|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|10|st|7|lb|3}}',
'{{Convert|10|st|7|lb|kg+lb|3|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert||kg|10|st|7|lb|sigfig=5}}',
'{{Convert|10|st|7|lb|kg+lb|sigfig=5|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|65|kg||st||lb|0}}',
'{{Convert|65|kg|lb+stlb|0|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|65|kg||st||lb|1}}',
'{{Convert|65|kg|lb+stlb|1|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|23|stone||kg||lb|lk=in|abbr=out}}',
'{{Convert|23|st|kg+lb|lk=in|abbr=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|160|kg||lb|-1|abbr=off}}',
'{{Convert|160|kg|lb|-1|abbr=off}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|150|L||USgal|1|abbr=off}}',
'{{Convert|150|L|USgal|1|abbr=off}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|3,287,263|km2|1,269,346|sqmi}}',
'{{Convert|3,287,263|km2|sqmi|abbr=on}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert}}', '')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|10}}', '')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|10|m}}', '')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|convert|10|m|2}}', '')
end
function p:test_convert_main()
convert_tester(self,'')
end
function p:test_convert_sandbox()
convert_tester(self,'/sandbox')
end
local function area_tester(tester,sandbox)
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|km2=222}}',
'{{Convert|222|km2|km2 sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|km2=222|name=United States}}',
'{{Convert|222|km2|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|km2=222|pref=US}}',
'{{Convert|222|km2|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|km2=222|link=on|name=[[United Kingdom]]}}',
'{{Convert|222|km2|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=100}}',
'{{Convert|100|sqmi|km2 sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=100|name=United States}}',
'{{Convert|100|sqmi|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=100|pref=US}}',
'{{Convert|100|sqmi|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=100|link=on|name=[[United Kingdom]]}}',
'{{Convert|100|sqmi|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|ha=222}}',
'{{Convert|222|ha|ha acre|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|ha=222|name=United States}}',
'{{Convert|222|ha|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|ha=222|pref=US}}',
'{{Convert|222|ha|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|ha=222|link=on|name=[[United Kingdom]]}}',
'{{Convert|222|ha|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|acre=100}}',
'{{Convert|100|acre|ha acre|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|acre=100|name=United States}}',
'{{Convert|100|acre|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|acre=100|pref=US}}',
'{{Convert|100|acre|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|acre=100|link=on|name=[[United Kingdom]]}}',
'{{Convert|100|acre|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=222}}',
'{{Convert|222|dunam|ha acre|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=10000}}',
'{{Convert|10000|dunam|km2 sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=222|name=United States}}',
'{{Convert|222|dunam|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=10000|name=United States}}',
'{{Convert|10000|dunam|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=222|pref=standard}}',
'{{Convert|222|dunam|acre ha|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=10000|pref=standard}}',
'{{Convert|10000|dunam|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=222|link=on|pref=dunam}}',
'{{Convert|222|dunam|dunam ha acre|abbr=on|order=out|lk=in}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=22,222|pref=dunam}}',
'{{Convert|22,222|dunam|dunam km2 sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=100|link=off|pref=dunam}}',
'{{Convert|100|dunam|dunam ha acre|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|dunam=10000|link=water|pref=dunam}}',
'{{Convert|10000|dunam|dunam km2 sqmi|abbr=on|order=out|lk=in}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=10|pref=US|name=Germany}}',
'{{Convert|10|sqmi|sqmi km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=10|pref=metric|name=United States}}',
'{{Convert|10|sqmi|km2 sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|area|sqmi=10|name=United Kingdom|pref=dunam}}',
'{{Convert|10|sqmi|sqmi km2|abbr=on|order=out}}')
end
function p:test_area_sandbox()
area_tester(self,'/sandbox')
end
function p:test_area_main()
area_tester(self,'')
end
local function length_tester(tester,sandbox)
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|km=222}}',
'{{Convert|222|km|km mi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|km=222|name=United States}}',
'{{Convert|222|km|mi km|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|km=222|pref=US}}',
'{{Convert|222|km|mi km|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|mi=100}}',
'{{Convert|100|mi|km mi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|mi=100|name=United States}}',
'{{Convert|100|mi|mi km|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|mi=100|pref=US}}',
'{{Convert|100|mi|mi km|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|m=222}}',
'{{Convert|222|m|m ft|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|m=222|name=United States}}',
'{{Convert|222|m|ft m|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|m=222|pref=US}}',
'{{Convert|222|m|ft m|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|ft=100}}',
'{{Convert|100|ft|m ft|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|ft=100|name=United States}}',
'{{Convert|100|ft|ft m|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|length|ft=100|pref=US}}',
'{{Convert|100|ft|ft m|abbr=on|order=out}}')
end
function p:test_length_sandbox()
length_tester(self,'/sandbox')
end
function p:test_length_main()
length_tester(self,'')
end
local function density_tester(tester,sandbox)
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=12,345.67}}',
'{{Convert|12,345.67|/km2|/km2 /sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=12,345.67}}',
'{{Convert|12,345.67|/sqmi|/km2 /sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=12,345.67 |pref=Imperial}}',
'{{Convert|12,345.67|/sqmi|/sqmi /km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=12,345.67 |name=United States}}',
'{{Convert|12,345.67|/sqmi|/sqmi /km2|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=12,345.67 |pref=metric}}',
'{{Convert|12,345.67|/km2|/km2 /sqmi|abbr=on|order=out}}')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=1.234 |pop=3456}}',
'{{Convert|2,800.6482982|/km2|/km2|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|2,800.6482982|/km2|/sqmi|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |sqmi=1.234 |pop=3456}}',
'{{Convert|2,800.6482982|/sqmi|/km2|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|2,800.6482982|/sqmi|/sqmi|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |acre=22222|pop=3456}}',
'{{Convert|0.15552155|/acre|/km2|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|0.15552155|/acre|/sqmi|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |ha=12000|pop=3456}}',
'{{Convert|0.288|/ha|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.288|/ha|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |dunam=222|pop=34}}',
'{{Convert|0.15315315|/dunam|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.15315315|/dunam|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |dunam=10000|pop=3456}}',
'{{Convert|0.3456|/dunam|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.3456|/dunam|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=1.234 |pop=3456 |pref=US}}',
'{{Convert|2,800.6482982|/km2|/sqmi|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|2,800.6482982|/km2|/km2|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |sqmi=1.234 |pop=3456 |pref=US}}',
'{{Convert|2,800.6482982|/sqmi|/sqmi|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|2,800.6482982|/sqmi|/km2|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |acre=22222|pop=3456 |pref=US}}',
'{{Convert|0.15552155|/acre|/sqmi|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|0.15552155|/acre|/km2|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |ha=12000|pop=3456 |pref=US}}',
'{{Convert|0.288|/ha|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.288|/ha|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |dunam=222|pop=34 |pref=US}}',
'{{Convert|0.15315315|/dunam|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.15315315|/dunam|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |dunam=10000|pop=3456 |pref=US}}',
'{{Convert|0.3456|/dunam|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.3456|/dunam|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=0.00023456 |pop=10}}',
'{{Convert|42633.01|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|42633.01|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=0.023456 |pop=10}}',
'{{Convert|426.3301|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|426.3301|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=2.3456 |pop=10}}',
'{{Convert|4.263301|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|4.263301|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=234.56 |pop=10}}',
'{{Convert|0.04263301|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.04263301|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=23456 |pop=10}}',
'{{Convert|0.0004263301|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|0.0004263301|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=auto |sqmi=10 |pop=123,456 |pref=Imperial}}',
'{{Convert|12345.6|/sqmi|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|12345.6|/sqmi|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=auto |sqmi=10 |pop=1234 |pref=Imperial}}',
'{{Convert|123.4|/sqmi|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|123.4|/sqmi|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=auto |sqmi=10 |pop=12 |pref=Imperial}}',
'{{Convert|1.2|/sqmi|/sqmi|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|1.2|/sqmi|/km2|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=88.1 |pop=233532}}',
'{{Convert|2,650.760|/km2|/km2|abbr=on|disp=out|sigfig=3}}'..
' ({{Convert|2,650.760|/km2|/sqmi|abbr=on|disp=out|sigfig=3}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=28.39 |pop=2,199}}',
'{{Convert|77.456851|/km2|/km2|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|77.456851|/km2|/sqmi|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/sqmi=auto |name=United States |pop=873965 |sqmi=46.91}}',
'{{Convert|18,630.6757|/sqmi|/sqmi|abbr=on|disp=out|sigfig=4}}'..
' ({{Convert|18,630.6757|/sqmi|/km2|abbr=on|disp=out|sigfig=4}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=10 | pop=123,456<ref>foo</ref>}}',
'{{Convert|12345.6|/km2|/km2|abbr=on|disp=out|sigfig=2}}'..
' ({{Convert|12345.6|/km2|/sqmi|abbr=on|disp=out|sigfig=2}})')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2= |pop=123,456}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=10 |pop=}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2= |pop=}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2= |km2= |pop=}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |foo=34.5 |pop=1,234}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2= |km2=10.0 |pop=1,234}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=blerg |km2=10.0 |pop=1,234}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=12.34 |pop=-4}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=12.34 |pop=blerg}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=-1.234 |pop=1,234}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |pop=1,234 |sqmi=0}}','')
tester:preprocess_equals_preprocess('{{#invoke:ConvertIB'..sandbox..'|density|/km2=auto |km2=blerg |pop=1,234}}','')
end
function p:test_density_main()
density_tester(self,'')
end
function p:test_density_sandbox()
density_tester(self,'/sandbox')
end
return p