From 5c67d561f73380df142ce715ca1dbdf87727a2e8 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Thu, 24 Aug 2023 17:35:03 -0400 Subject: [PATCH] test: avoid using floats whose rounding is affected by valgrind Without valgrind, "1.4" is inserted as 1.39999999999999991118, but with valgrind it is inserted as 1.40000000000000013323. Let's just use "1.5". --- test/test_integration_statement.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_integration_statement.rb b/test/test_integration_statement.rb index 20dd6fcc..759941f3 100644 --- a/test/test_integration_statement.rb +++ b/test/test_integration_statement.rb @@ -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