|
|
|
@ -49,6 +49,14 @@ define([ |
|
|
|
expect(rootNode.params.length).to.be(1); |
|
|
|
expect(rootNode.params.length).to.be(1); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('simple function2', function() { |
|
|
|
|
|
|
|
var parser = new Parser('offset(test.metric, -100)'); |
|
|
|
|
|
|
|
var rootNode = parser.getAst(); |
|
|
|
|
|
|
|
expect(rootNode.type).to.be('function'); |
|
|
|
|
|
|
|
expect(rootNode.params[0].type).to.be('metric'); |
|
|
|
|
|
|
|
expect(rootNode.params[1].type).to.be('number'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('simple function with string arg', function() { |
|
|
|
it('simple function with string arg', function() { |
|
|
|
var parser = new Parser("randomWalk('test')"); |
|
|
|
var parser = new Parser("randomWalk('test')"); |
|
|
|
var rootNode = parser.getAst(); |
|
|
|
var rootNode = parser.getAst(); |
|
|
|
@ -125,6 +133,13 @@ define([ |
|
|
|
expect(rootNode.pos).to.be(11); |
|
|
|
expect(rootNode.pos).to.be(11); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('handle issue #69', function() { |
|
|
|
|
|
|
|
var parser = new Parser('cactiStyle(offset(scale(net.192-168-1-1.192-168-1-9.ping_value.*,0.001),-100))'); |
|
|
|
|
|
|
|
var rootNode = parser.getAst(); |
|
|
|
|
|
|
|
expect(rootNode.type).to.be('function'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|