From a6785c6b7b7773351c5229f5051a4cb8e17b8eae Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 5 Jun 2012 05:14:24 +0200 Subject: [PATCH] have the bson-attrib tests all in one place so we can choose not to use them --- scripts/tests/bson.lua | 26 ++++++++++++++++++++++++++ scripts/tests/common.lua | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/tests/bson.lua b/scripts/tests/bson.lua index a7c12d75c..0ee6e6e2e 100644 --- a/scripts/tests/bson.lua +++ b/scripts/tests/bson.lua @@ -37,3 +37,29 @@ function test_bson_readwrite() assert_equal(a.data, 42) end end + +function test_bson() + local r = region.create(0, 0, "mountain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + assert_not_equal(nil, u) + assert_not_equal(nil, r) + assert_not_equal(nil, f) + attrib.create(r, 1) + assert_equal(attrib.get(r)().data, 1) + attrib.create(u, 3) + assert_equal(attrib.get(u)().data, 3) + attrib.create(f, 5) + assert_equal(attrib.get(f)().data, 5) +end + +function test_bson_with_multiple_attribs() + local r = region.create(0, 0, "mountain") + attrib.create(r, { a=1}) + attrib.create(r, { a=5}) + local total = 0 + for a in attrib.get(r) do + total = total + a.data.a; + end + assert_equal(6, total) +end diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index 6c98b19ac..635b06f34 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -960,32 +960,6 @@ function test_bug_1679() assert_true(find_in_report(f, "entdeckt, dass es keinen Weg nach Westen gibt")) end -function test_bson() - local r = region.create(0, 0, "mountain") - local f = faction.create("noreply@eressea.de", "human", "de") - local u = unit.create(f, r, 1) - assert_not_equal(nil, u) - assert_not_equal(nil, r) - assert_not_equal(nil, f) - attrib.create(r, 1) - assert_equal(attrib.get(r)().data, 1) - attrib.create(u, 3) - assert_equal(attrib.get(u)().data, 3) - attrib.create(f, 5) - assert_equal(attrib.get(f)().data, 5) -end - -function test_bson_with_multiple_attribs() - local r = region.create(0, 0, "mountain") - attrib.create(r, { a=1}) - attrib.create(r, { a=5}) - local total = 0 - for a in attrib.get(r) do - total = total + a.data.a; - end - assert_equal(6, total) -end - function test_building_unique0() local r = region.create(0, 0, "mountain") local f = faction.create("noreply@eressea.de", "human", "de")