Skip to content

Commit

Permalink
Test stability for Windows/32bit
Browse files Browse the repository at this point in the history
  • Loading branch information
klayoutmatthias committed Feb 28, 2021
1 parent 8d6a43b commit 5e0239c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
25 changes: 14 additions & 11 deletions testdata/python/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,34 +1160,37 @@ 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 )
self.assertEqual( b.b20a( 1 ), False )
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 )
Expand All @@ -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" )
Expand Down
9 changes: 8 additions & 1 deletion testdata/ruby/basic_testcore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_FIRST

a = nil
GC.start
GC.start
assert_equal( RBA::A::instance_count, ic0 )

a = RBA::A.new
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5e0239c

Please sign in to comment.