From 50784b425f2ee89a7c49388a340345ad65fcabb9 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 16 Apr 2015 20:34:47 +0700 Subject: [PATCH] tests: update test_ffi_c_operators for << and >> Signed-off-by: Jean Privat --- tests/sav/test_ffi_c_operators.res | 2 ++ tests/test_ffi_c_operators.nit | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) 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 -- 1.7.9.5