diff options
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/regression/3637.yaml')
-rw-r--r-- | ext/librethinkdbxx/test/upstream/regression/3637.yaml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/regression/3637.yaml b/ext/librethinkdbxx/test/upstream/regression/3637.yaml new file mode 100644 index 00000000..98909e09 --- /dev/null +++ b/ext/librethinkdbxx/test/upstream/regression/3637.yaml @@ -0,0 +1,51 @@ +desc: Test that negative zero and positive zero refer to the same row +table_variable_name: tbl +tests: + # In order to send a `-0` from JS we need to provide raw JSON + - cd: tbl.insert([{'id':0.0, 'value':'abc'}, {'id':[1, -0.0], 'value':'def'}]) + js: tbl.insert([{'id':0.0, 'value':'abc'}, {'id':[1, r.json('-0.0')], 'value':'def'}]) + ot: partial({'inserted':2}) + + # Test getting the rows by their original and opposite id + - cd: tbl.get(0.0) + ot: {'id':0.0, 'value':'abc'} + + - cd: tbl.get(-0.0) + js: tbl.get(r.json('-0.0')) + ot: {'id':0.0, 'value':'abc'} + + - cd: tbl.get([1, 0.0]) + ot: {'id':[1, -0.0], 'value':'def'} + + - cd: tbl.get([1, -0.0]) + js: tbl.get([1, r.json('-0.0')]) + ot: {'id':[1, -0.0], 'value':'def'} + + # Because I don't trust our test framework, test against a JSON string + - cd: tbl.get(0.0).pluck('id').to_json_string() + ot: '{"id":0}' + + - cd: tbl.get(-0.0).pluck('id').to_json_string() + js: tbl.get(r.json('-0.0')).pluck('id').to_json_string() + ot: '{"id":0}' + + - cd: tbl.get([1, 0.0]).pluck('id').to_json_string() + ot: '{"id":[1,-0.0]}' + + - cd: tbl.get([1, -0.0]).pluck('id').to_json_string() + js: tbl.get([1, r.json('-0.0')]).pluck('id').to_json_string() + ot: '{"id":[1,-0.0]}' + + # Test inserting a duplicate + - cd: + - tbl.insert({'id':0.0}) + - tbl.insert({'id':[1,0.0]}) + ot: partial({'errors':1}) + + - cd: + - tbl.insert({'id':-0.0}) + - tbl.insert({'id':[1,-0.0]}) + js: + - tbl.insert({'id':r.json('-0.0')}) + - tbl.insert({'id':[1,r.json('-0.0')]}) + ot: partial({'errors':1}) |