52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
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})
|