mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-15 23:41:57 +00:00
53 lines
1.2 KiB
YAML
53 lines
1.2 KiB
YAML
desc: Tests for the basic usage of the division operation
|
|
tests:
|
|
|
|
- cd: r(4).div(2)
|
|
py:
|
|
- r.expr(4) / 2
|
|
- 4 / r.expr(2)
|
|
- r.expr(4).div(2)
|
|
rb:
|
|
- (r 4) / 2
|
|
- r(4).div 2
|
|
- 4 / r(2)
|
|
ot: 2
|
|
|
|
- py: r.expr(-1) / -2
|
|
js: r(-1).div(-2)
|
|
rb: (r -1) / -2
|
|
ot: 0.5
|
|
|
|
- py: r.expr(4.9) / 0.7
|
|
js: r(4.9).div(0.7)
|
|
rb: (r 4.9) / 0.7
|
|
ot: 4.9 / 0.7
|
|
|
|
- cd: r.expr(1).div(2,3,4,5)
|
|
ot: 1.0/120
|
|
|
|
# Divide by zero test
|
|
- cd:
|
|
- r(1).div(0)
|
|
- r(2.0).div(0)
|
|
- r(3).div(0.0)
|
|
- r(4.0).div(0.0)
|
|
- r(0).div(0)
|
|
- r(0.0).div(0.0)
|
|
py:
|
|
- r.expr(1) / 0
|
|
- r.expr(2.0) / 0
|
|
- r.expr(3) / 0.0
|
|
- r.expr(4.0) / 0.0
|
|
- r.expr(0) / 0
|
|
- r.expr(0.0) / 0.0
|
|
ot: err('ReqlQueryLogicError', 'Cannot divide by zero.', [1])
|
|
|
|
# Type errors
|
|
- py: r.expr('a') / 0.8
|
|
cd: r('a').div(0.8)
|
|
ot: err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0])
|
|
|
|
- py: r.expr(1) / 'a'
|
|
cd: r(1).div('a')
|
|
ot: err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1])
|