From: Jean Privat Date: Thu, 16 Apr 2015 13:34:47 +0000 (+0700) Subject: tests: update test_ffi_c_operators for << and >> X-Git-Tag: v0.7.4~20^2 X-Git-Url: http://nitlanguage.org tests: update test_ffi_c_operators for << and >> Signed-off-by: Jean Privat --- diff --git a/tests/sav/test_ffi_c_operators.res b/tests/sav/test_ffi_c_operators.res index e80f5de..893e1ea 100644 --- a/tests/sav/test_ffi_c_operators.res +++ b/tests/sav/test_ffi_c_operators.res @@ -20,6 +20,8 @@ false false true true +32 +8 52 456 123 diff --git a/tests/test_ffi_c_operators.nit b/tests/test_ffi_c_operators.nit index 271589e..5261b5e 100644 --- a/tests/test_ffi_c_operators.nit +++ b/tests/test_ffi_c_operators.nit @@ -102,14 +102,16 @@ class A return A_value( recv ) <= A_value( other ); `} - fun >>( other : A ) import value, value=, A `{ + fun >>( other : A ): A import value, value=, A `{ int new_val = A_value( recv ) >> A_value( other ); A_value__assign( recv, new_val ); + return recv; `} - fun <<( other : A ) import value, A `{ + fun <<( other : A ): A import value, A `{ int new_val = A_value( recv ) << A_value( other ); A_value__assign( recv, new_val ); + return recv; `} fun []( index : Int ) : A import A `{ @@ -154,13 +156,13 @@ print new A( 1 ) >= new A( 100 ) # false print new A( 100 ) >= new A( 100 ) # true print new A( 100 ) >= new A( 1 ) # true -#var x = new A( 1 ) -#x << new A( 5 ) -#print x # 16 +var x = new A( 1 ) +x = x << new A( 5 ) +print x # 32 -#var y = new A( 32 ) -#y >> new A( 2 ) -#print y # 8 +var y = new A( 32 ) +y = y >> new A( 2 ) +print y # 8 var a = new A( 456 ) print a[ 52 ] # 52