forked from github/server
have the bson-attrib tests all in one place so we can choose not to use them
This commit is contained in:
parent
86928b5c31
commit
a6785c6b7b
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue