2017-11-02 07:05:11 -07:00

61 lines
1.5 KiB
YAML

desc: Tests for the basic usage of the multiplication operation
tests:
- cd: r.expr(1).mul(2)
py:
- r.expr(1) * 2
- 1 * r.expr(2)
- r.expr(1).mul(2)
rb:
- (r 1) * 2
- r(1).mul(2)
- 1 * (r 2)
ot: 2
- py: r.expr(-1) * -1
js: r(-1).mul(-1)
rb: (r -1) * -1
ot: 1
- cd: r.expr(1.5).mul(4.5)
py: r.expr(1.5) * 4.5
rb: (r 1.5) * 4.5
ot: 6.75
- py: r.expr([1,2,3]) * 3
js: r([1,2,3]).mul(3)
rb: (r [1,2,3]) * 3
ot: [1,2,3,1,2,3,1,2,3]
- cd: r.expr(1).mul(2,3,4,5)
ot: 120
- cd: r(2).mul([1,2,3], 2)
py: # this form does not work in Python
ot: [1,2,3,1,2,3,1,2,3,1,2,3]
- cd: r([1,2,3]).mul(2, 2)
py: # this form does not work in Python
ot: [1,2,3,1,2,3,1,2,3,1,2,3]
- cd: r(2).mul(2, [1,2,3])
py: # this form does not work in Python
ot: [1,2,3,1,2,3,1,2,3,1,2,3]
# Type errors
- py: r.expr('a') * 0.8
cd: r('a').mul(0.8)
ot: err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0])
- py: r.expr(1) * 'a'
cd: r(1).mul('a')
ot: err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1])
- py: r.expr('b') * 'a'
cd: r('b').mul('a')
ot: err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0])
- py: r.expr([]) * 1.5
cd: r([]).mul(1.5)
ot: err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0])