Deze module is nog in ontwikkeling (versie 0.0) en wordt getest.
De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over deze onderwijswiki beschikbaar.
localtest={}localCFG=require("Module:Layout/Production/Configuration");localarray=CFG.INCLUDE("production","array");localunittest=CFG.INCLUDE("production","unittest");test=unittest:new();functiontest.main(frame)returntest.run(frame);endfunctiontest:test_array_copy()localinput_1={1,2,{3,4},5};-- Test 1: Check if the copied table is not a referencelocaloutput_1=array.copy(input_1);input_1[1]=99;self:assertEquals(false,input_1[1]==output_1[1],"Check if the copied table is not a reference");-- Test 2: Check if the nested table is not a referencelocaloutput_2=array.copy(input_1);input_1[3][1]=88;self:assertEquals(false,input_1[3][1]==output_2[3][1],"Check if the nested table is not a reference");endfunctiontest:test_array_search()localinput_1={"apple","banana","cherry","date"};-- Test 1: Search for existing valuelocalexpected_1=3;localsearch_value_1="cherry";localoutput_1=array.search(input_1,search_value_1);self:assertEquals(expected_1,output_1,"Search for cherry");-- Test 2: Search for non-existent valuelocalexpected_2=false;localsearch_value_2="orange";localoutput_2=array.search(input_1,search_value_2);self:assertEquals(expected_2,output_2,"Search for orange not found");-- Test 3: Search in an empty arraylocalexpected_3=false;localsearch_value_3="apple";localoutput_3=array.search({},search_value_3);self:assertEquals(expected_3,output_3,"Search in an empty array");-- Test 4: Case-insentive searchlocalexpected_4=1;localsearch_value_4="aPple";localcase_insentive=true;localoutput_4=array.search(input_1,search_value_4,case_insentive);self:assertEquals(expected_4,output_4,"Case-insentive search");endfunctiontest:test_array_slice()localinput_1={1,2,3,4,5};-- Test 1: Slice with default parameterslocalexpected_1=input_1;localoutput_1=array.slice(input_1);self:assertDeepEquals(expected_1,output_1,"Slice with default parameters");-- Test 2: Slice with start past end of arraylocalexpected_2={};localoutput_2=array.slice(input_1,6);self:assertDeepEquals(expected_2,output_2,"Slice with start past end of array");-- Test 3: Slice with negative startlocalexpected_3={3,4,5};localoutput_3=array.slice(input_1,-3);self:assertDeepEquals(expected_3,output_3,"Slice with negative start");-- Test 4: Slice with negative endlocalexpected_4={1,2,3};localoutput_4=array.slice(input_1,1,-3);self:assertDeepEquals(expected_4,output_4,"Slice with negative end");endreturntest;