Module:BethNaught/RHH/testcases

-- Unit tests for Module:BethNaught/RHH. Null edit talk page to run tests. -- © 2018 BethNaught, CC BY-SA 3.0 local p = require('Module:UnitTests')

function p:test_three_supported self:preprocess_equals_many(, {   	-- pagenum provided, empty or non-provided center    	{'pagenum=5|center=', },    	{'pagenum=6000', },    	-- pagenum provided, center provided, others not provided    	{'pagenum=5|center=CENTER', },    	{'pagenum=6000|center=CENTER', },    	-- pagenum provided, center_even and center_odd provided    	{'pagenum=88|center_even=EVEN|center_odd=ODD', },    	{'pagenum=101|center_odd=ODD|center_even=EVEN', },    	-- pagenum provided, center_even only provided    	{'pagenum=88|center_even=EVEN', },    	{'pagenum=101|center_even=EVEN', },    	-- pagenum provided, center_odd only provided    	{'pagenum=88|center_odd=ODD', },    	{'pagenum=101|center_odd=ODD', ''},    }, {nowiki=1}) end

function p:test_three_unsupported_overrides self:preprocess_equals_many(, {   	-- pagenum provided, center provided as well as center_odd and/or    	-- center_even: the _odd and _even should be overridden    	{'pagenum=91|center=CENTER|center_even=E', },    	{'pagenum=91|center=CENTER|center_odd=O', },    	{'pagenum=66|center=CENTER|center_even=E', },    	{'pagenum=66|center=CENTER|center_odd=O', },    	{'pagenum=88|center=CENTER|center_even=E|center_odd=O', },    	{'pagenum=101|center=CENTER|center_odd=O|center_even=E', ''}    }, {nowiki=1}) end

function p:test_three_unsupported_no_pagenum self:preprocess_equals_many(, {   	-- pagenum not provided: should return empty RunningHeader for now    	{'center=CENTER', },    	{'center_even=EVEN|center_odd=ODD', },    	{'center=CENTER|center_even=EVEN|center_odd=ODD', }    }, {nowiki=1}) end

function p:test_three_unsupported_invalid_pagenum self:preprocess_equals_many(, {   	-- pagenum invalid: should return empty RunningHeader for now    	{'pagenum=xyz|center=CENTER', },    	{'pagenum=xyz|center_even=EVEN|center_odd=ODD', },    	{'pagenum=xyz|center=CENTER|center_even=EVEN|center_odd=ODD', },    	{'pagenum=5.9|center=CENTER', },    	{'pagenum=5.9|center_even=EVEN|center_odd=ODD', },    	{'pagenum=5.9|center=CENTER|center_even=EVEN|center_odd=ODD', ''}    }, {nowiki=1}) end

return p