Skip to content

Commit

Permalink
test: avoid using floats whose rounding is affected by valgrind
Browse files Browse the repository at this point in the history
Without valgrind, "1.4" is inserted as 1.39999999999999991118, but
with valgrind it is inserted as 1.40000000000000013323. Let's just use
"1.5".
  • Loading branch information
flavorjones committed Aug 24, 2023
1 parent 7569b46 commit 5c67d56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test_integration_statement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def test_bind_param_by_name_good
def test_bind_param_with_various_types
@db.transaction do
@db.execute "create table all_types ( a integer primary key, b float, c string, d integer )"
@db.execute "insert into all_types ( b, c, d ) values ( 1.4, 'hello', 68719476735 )"
@db.execute "insert into all_types ( b, c, d ) values ( 1.5, 'hello', 68719476735 )"
end

assert_equal 1, @db.execute( "select * from all_types where b = ?", 1.4 ).length
assert_equal 1, @db.execute( "select * from all_types where b = ?", 1.5 ).length
assert_equal 1, @db.execute( "select * from all_types where c = ?", 'hello').length
assert_equal 1, @db.execute( "select * from all_types where d = ?", 68719476735).length
end
Expand Down

0 comments on commit 5c67d56

Please sign in to comment.