diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index b77606266..511f275db 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -155,7 +155,7 @@ end function test_pure() local r = region.create(0, 0, "plain") - assert_not_equal(nil, r) + assert_not_nil(r) assert_equal(r, get_region(0, 0)) end @@ -170,21 +170,21 @@ function test_read_write() assert_equal(r.terrain, "plain") result = eressea.write_game("test.dat") assert_equal(result, 0) - assert_not_equal(get_region(0, 0), nil) - assert_not_equal(get_faction(fno), nil) - assert_not_equal(get_unit(uno), nil) + assert_not_nil(get_region(0, 0)) + assert_not_nil(get_faction(fno)) + assert_not_nil(get_unit(uno)) r = nil f = nil u = nil eressea.free_game() - assert_equal(get_region(0, 0), nil) - assert_equal(nil, get_faction(fno)) - assert_equal(nil, get_unit(uno)) + assert_nil(get_region(0, 0)) + assert_nil(get_faction(fno)) + assert_nil(get_unit(uno)) result = eressea.read_game("test.dat") assert_equal(0, result) - assert_not_equal(nil, get_region(0, 0)) - assert_not_equal(nil, get_faction(fno)) - assert_not_equal(nil, get_unit(uno)) + assert_not_nil(get_region(0, 0)) + assert_not_nil(get_faction(fno)) + assert_not_nil(get_unit(uno)) end function test_descriptions() @@ -238,7 +238,7 @@ function test_gmtool() selections=selections+1 end assert_equal(2, selections) - assert_equal(nil, gmtool.get_cursor()) + assert_nil(gmtool.get_cursor()) gmtool.close() end @@ -568,7 +568,7 @@ function test_coordinate_translation() local pe = plane.create(1, -8761, 3620, 23, 23) -- eternath local r = region.create(1000, 1000, "plain") local f = create_faction('human') - assert_not_equal(nil, r) + assert_not_nil(r) assert_equal(r.x, 1000) assert_equal(r.y, 1000) local nx, ny = plane.normalize(pl, r.x, r.y) @@ -634,8 +634,8 @@ end -- segfault above function test_config() - assert_not_equal(nil, config.basepath) - assert_not_equal(nil, config.locales) + assert_not_nil(config.basepath) + assert_not_nil(config.locales) end local function _test_create_laen() @@ -827,9 +827,9 @@ function test_swim_and_die() process_orders() r.terrain = "ocean" u = get_unit(uid) - assert_not_equal(get_unit(uid), nil) + assert_not_nil(get_unit(uid)) process_orders() - assert_equal(get_unit(uid), nil) + assert_nil(get_unit(uid)) end function test_ride_with_horse() diff --git a/scripts/tests/e2/production.lua b/scripts/tests/e2/production.lua index 5070d02f6..852d8f629 100644 --- a/scripts/tests/e2/production.lua +++ b/scripts/tests/e2/production.lua @@ -101,14 +101,14 @@ function test_build_boat_low_skill() u:add_item("log", 10) u:add_order("MACHE BOOT") process_orders() - assert_not_equal(nil, u.ship) + assert_not_nil(u.ship) assert_equal(4, u.ship.size) assert_equal(6, u:get_item('log')) end function test_build_boat_high_skill() local r = region.create(0, 0, "plain") - local f = faction.create("human", "build@example.com") + local f = faction.create("human", "skillz@example.com") local u = unit.create(f, r, 1) u:set_skill("shipcraft", 5) -- humans get +1 u:add_item("log", 10) diff --git a/src/kernel/race.h b/src/kernel/race.h index de0fd92e0..65cb0cf73 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -233,7 +233,7 @@ extern "C" { #define RCF_MIGRANTS (1<<28) /* may have migrant units (human bonus) */ #define RCF_FAMILIAR (1<<29) /* may be a familiar */ -#define RCF_DEFAULT 0 +#define RCF_DEFAULT RCF_CANSAIL /* Economic flags */ #define ECF_GIVEPERSON (1<<0) /* �bergibt Personen */ diff --git a/src/kernel/race.test.c b/src/kernel/race.test.c index e1c255ef2..ac0609a69 100644 --- a/src/kernel/race.test.c +++ b/src/kernel/race.test.c @@ -50,7 +50,7 @@ static void test_rc_defaults(CuTest *tc) { CuAssertDblEquals(tc, 1.0, rc->recruit_multi, 0.0); CuAssertDblEquals(tc, 1.0, rc->regaura, 0.0); CuAssertDblEquals(tc, 1.0, rc->speed, 0.0); - CuAssertIntEquals(tc, 0, rc->flags); + CuAssertIntEquals(tc, RCF_DEFAULT, rc->flags); CuAssertIntEquals(tc, 0, rc->recruitcost); CuAssertIntEquals(tc, 0, rc->maintenance); CuAssertIntEquals(tc, 540, rc->capacity);