Skip to content

Commit

Permalink
* fixed unit tests t_map.e, t_callc.e, and t_warnings.e
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnpringle committed Sep 12, 2018
1 parent c7baf89 commit e5b8fe8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions source/msgtext.e
Original file line number Diff line number Diff line change
Expand Up @@ -605,12 +605,12 @@ constant StdErrMsgs = {
{ MSG_1_WORD_MUST_BE_AN_IDENTIFIER , "[1] word must be an identifier" },
{ MSG_1__MODULE_CONSTANT_2_IS_NOT_USED , "[1] - module constant '[2]' is not used" },
{ MSG_1__MODULE_VARIABLE_2_IS_ASSIGNED_BUT_NEVER_USED, "[1] - module variable '[2]' is assigned but never used" },
{ MSG_1__MODULE_VARIABLE_2_IS_NEVER_ASSIGNED_A_VALUE, "[1] - module variable '[2]' is never assigned a value" },
{ MSG_1__MODULE_VARIABLE_2_IS_NEVER_ASSIGNED_A_VALUE, "[1] - module variable '[2]' is read from but never assigned a value" },
{ MSG_1__MODULE_VARIABLE_2_IS_NOT_USED , "[1] - module variable '[2]' is not used" },
{ MSG_1__PARAMETER_2_OF_3_IS_ASSIGNED_BUT_NEVER_USED, "[1] - parameter '[2]' of [3]() is assigned but never used" },
{ MSG_1__PARAMETER_2_OF_3_IS_NOT_USED , "[1] - parameter '[2]' of [3]() is not used" },
{ MSG_1__PRIVATE_VARIABLE_2_OF_3_IS_ASSIGNED_BUT_NEVER_USED, "[1] - private variable '[2]' of [3]() is assigned but never used" },
{ MSG_1__PRIVATE_VARIABLE_2_OF_3_IS_NEVER_ASSIGNED_A_VALUE, "[1] - private variable '[2]' of [3] is never assigned a value" },
{ MSG_1__PRIVATE_VARIABLE_2_OF_3_IS_NEVER_ASSIGNED_A_VALUE, "[1] - private variable \'[2]\' of [3] is read from but never assigned a value" },
{ MSG_1__PRIVATE_VARIABLE_2_OF_3_IS_NOT_USED , "[1] - private variable '[2]' of [3]() is not used" },
{ MSG_CC_PREFIX , "Prefix for compiler and related binaries" },
{ MSG_DELETED , "-deleted-" },
Expand Down
9 changes: 9 additions & 0 deletions tests/t_callc.e
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ enum false=0, true=1

atom r_max_uint_fn
for i = 1 to length(minus_1_values) do
if pointer_size < 8 and minus_1_values[i] = MAXUINT64 then
exit
end if
r_max_uint_fn = define_c_func( "", call_back( routine_id("minus_1_fn") ), {}, unsigned_types[i] )
test_equal( sprintf("return type %s makes unsigned value", {unsigned_type_names[i]}), minus_1_values[i], c_func(r_max_uint_fn, {}) )
end for
Expand All @@ -100,6 +103,9 @@ constant types = signed_types & unsigned_types
constant type_names = signed_type_names & unsigned_type_names
constant values = signed_values & unsigned_values
for i = 1 to length(signed_types) do
if pointer_size < 8 and signed_types[i] = C_LONGLONG then
continue
end if
-- 32-bit callbacks don't return anything big enough to be a C_LONGLONG, so skip those
if find(signed_types[i], floating_point_types) then
continue
Expand Down Expand Up @@ -163,6 +169,9 @@ object fs
for i = 1 to length(signed_types) do
-- test that values get encoded well when coming out from C.
-- test special values and ranges in EUPHORIA
if pointer_size < 8 and signed_types[i] = C_LONGLONG then
continue
end if
integer test_boundary_values
ifdef not EU4_0 then
-- we test bool because bool can be as big as an int.
Expand Down
5 changes: 2 additions & 3 deletions tests/t_map.e
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ test_equal("map m1 size#2", 1006, map:size(m1))
test_equal("map m1 get 5#2", "5", map:get(m1, 5, 999) )
test_equal("map m1 get 1000", "1000", map:get(m1, 1000, 999) )

-- add 2000 floats
o2 = map:threshold(o1)
-- add 1000 floats
for i = 1 to 1000 do
map:put(m1, -i*1.333333, i)
end for
Expand Down Expand Up @@ -639,7 +638,7 @@ procedure remove_name( sequence name )
validate_map( name, 1 )
map:remove( init_routines, name )
integer nx = find( name, names )
names = remove( names, nx )
names = eu:remove( names, nx )
validate_map( name, 0 )
end procedure

Expand Down

0 comments on commit e5b8fe8

Please sign in to comment.