From b73169616ba06be50a56583ab91e3b5b6a3afa6f Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 21 Dec 2018 11:49:56 +0100 Subject: [PATCH] Fix producer test Updating the values for substitutions was forgotten in 808e7fa, leading to a failing test 5. --- planet/Tests.ocf/Producers.ocs/Script.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/planet/Tests.ocf/Producers.ocs/Script.c b/planet/Tests.ocf/Producers.ocs/Script.c index c63d7046c..6cd9e542a 100644 --- a/planet/Tests.ocf/Producers.ocs/Script.c +++ b/planet/Tests.ocf/Producers.ocs/Script.c @@ -427,9 +427,9 @@ global func Test5_OnStart(int plr) Log("Testing the behaviour of ProductionCosts()"); - passed &= doTest("Costs for single component object (Metal). Got %v, expected %v.", producer->ProductionCosts(Metal), [[Ore, 1]]); - passed &= doTest("Costs for multi component object (Pickaxe). Got %v, expected %v.", producer->ProductionCosts(Pickaxe), [[Metal, 1], [Wood, 1]]); - passed &= doTest("Costs for object with liquid and fuel need (Bread). Got %v, expected %v.", producer->ProductionCosts(Bread), [[Flour, 1], [Water, 50]]); + passed &= doTest("Costs for single component object (Metal). Got %v, expected %v.", producer->ProductionCosts(Metal), [[Ore, 1, nil]]); + passed &= doTest("Costs for multi component object (Pickaxe). Got %v, expected %v.", producer->ProductionCosts(Pickaxe), [[Metal, 1, nil], [Wood, 1, nil]]); + passed &= doTest("Costs for object with liquid and fuel need (Bread). Got %v, expected %v.", producer->ProductionCosts(Bread), [[Flour, 1, nil], [Water, 50, nil]]); producer->RemoveObject(); return passed; @@ -856,8 +856,13 @@ global func doTest(description, returned, expected) for (var i = 0; i < GetLength(expected); ++i) { - passed &= doTest(Format("*%s", description), returned[i], expected[i]); - } + passed &= doTest(Format("* %s", description), returned[i], expected[i]); + } + // Additional output if the returned values are more than expected + for (var i = GetLength(expected); i < GetLength(returned); ++i) + { + passed &= doTest(Format("* %s", description), returned[i], expected[i]); + } return passed; }