From 5e0239c3d131c9d0e08a1e70912aea7eba5ba7b1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 28 Feb 2021 13:50:33 +0100 Subject: [PATCH] Test stability for Windows/32bit --- testdata/python/basic.py | 25 ++++++++++++++----------- testdata/ruby/basic_testcore.rb | 9 ++++++++- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/testdata/python/basic.py b/testdata/python/basic.py index 1af2b40551..c599ecf019 100644 --- a/testdata/python/basic.py +++ b/testdata/python/basic.py @@ -1160,6 +1160,9 @@ def test_22(self): # test client data binding to C++ objects b = pya.B() + + longint = 10000000000000000 + longint_as_int = (sys.maxsize > 5000000000 or (str(longint) == "10000000000000000" and type(longint) is int)) self.assertEqual( b.b20a( 5.0 ), False ) self.assertEqual( b.b20a( None ), True ) @@ -1167,27 +1170,27 @@ def test_22(self): self.assertEqual( b.b20a( "hallo" ), False ) self.assertEqual( b.b20a( False ), False ) self.assertEqual( b.b20a( True ), False ) - self.assertEqual( b.b20a( 10000000000000000 ), False ) + self.assertEqual( b.b20a( longint ), False ) self.assertEqual( b.b20b( 5.0 ), True ) self.assertEqual( b.b20b( None ), False ) self.assertEqual( b.b20b( 1 ), False ) self.assertEqual( b.b20b( "hallo" ), False ) self.assertEqual( b.b20b( False ), False ) self.assertEqual( b.b20b( True ), False ) - if sys.maxsize > 5000000000: - # on 64 bit platforms this fits into a long value, therefore this test returns false: - self.assertEqual( b.b20b( 10000000000000000 ), False ) + if longint_as_int: + # this fits into a long value, therefore this test returns false: + self.assertEqual( b.b20b( longint ), False ) else: # otherwise it is converted to a double: - self.assertEqual( b.b20b( 10000000000000000 ), True ) + self.assertEqual( b.b20b( longint ), True ) self.assertEqual( b.b20c( 5.0 ), False ) self.assertEqual( b.b20c( None ), False ) - if sys.maxsize > 5000000000: - # on 64 bit platforms this fits into a long value, therefore this test returns True: - self.assertEqual( b.b20c( 10000000000000000 ), True ) + if longint_as_int: + # this fits into a long value, therefore this test returns false: + self.assertEqual( b.b20c( longint ), True ) else: # otherwise it is converted to a double and the test returns false: - self.assertEqual( b.b20c( 10000000000000000 ), False ) + self.assertEqual( b.b20c( longint ), False ) self.assertEqual( b.b20c( "hallo" ), False ) self.assertEqual( b.b20c( False ), False ) self.assertEqual( b.b20c( True ), False ) @@ -1197,14 +1200,14 @@ def test_22(self): self.assertEqual( b.b20d( "hallo" ), True ) self.assertEqual( b.b20d( False ), False ) self.assertEqual( b.b20d( True ), False ) - self.assertEqual( b.b20d( 10000000000000000 ), False ) + self.assertEqual( b.b20d( longint ), False ) self.assertEqual( b.b20e( 5.0 ), False ) self.assertEqual( b.b20e( None ), False ) self.assertEqual( b.b20e( 1 ), False ) self.assertEqual( b.b20e( "hallo" ), False ) self.assertEqual( b.b20e( False ), True ) self.assertEqual( b.b20e( True ), True ) - self.assertEqual( b.b20e( 10000000000000000 ), False ) + self.assertEqual( b.b20e( longint ), False ) self.assertEqual( b.b21a( 50 ), "50" ) self.assertEqual( b.b21a( True ), "true" ) diff --git a/testdata/ruby/basic_testcore.rb b/testdata/ruby/basic_testcore.rb index 3099507e7f..60f4462795 100644 --- a/testdata/ruby/basic_testcore.rb +++ b/testdata/ruby/basic_testcore.rb @@ -27,6 +27,7 @@ def test_FIRST a = nil GC.start + GC.start assert_equal( RBA::A::instance_count, ic0 ) a = RBA::A.new @@ -2675,13 +2676,16 @@ def test_72 GC.start + nx = RBA::X::instances z = RBA::Z::new - nx = RBA::X::instances x = RBA::X::new("1") z.set_x(x) assert_equal(RBA::X::instances, nx + 1) + # weird. On WIN/32bit, this makes the test pass (enables GC somehow?): + puts("ANYTHING") + x = nil z.set_x(nil) GC.start @@ -2697,6 +2701,9 @@ def test_72 assert_equal(RBA::X::instances, nx + 1) + # weird. On WIN/32bit, this makes the test pass (enables GC somehow?): + puts("ANYTHING") + # this will release the object - hence it's going to be deleted z.set_x_keep(nil) GC.start