def test_long_add_and_fetch(): l = ffi.new('long *', 0) assert lib.long_add_and_fetch(l, 1) == 1 assert lib.long_add_and_fetch(l, 10) == 11
def test_long_bool_compare_and_swap(): l = ffi.new('long *', 0) assert lib.long_bool_compare_and_swap(l, 0, 10) == True assert lib.long_bool_compare_and_swap(l, 1, 20) == False
def test_long_sub_and_fetch(): l = ffi.new('long *', 0) assert lib.long_sub_and_fetch(l, 1) == -1 assert lib.long_sub_and_fetch(l, 10) == -11