MCPcopy Create free account
hub / github.com/antchfx/xpath / Test_func_number

Function Test_func_number

xpath_function_test.go:186–195  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func Test_func_number(t *testing.T) {
187 test_xpath_eval(t, empty_example, `number(10)`, float64(10))
188 test_xpath_eval(t, empty_example, `number(1.11)`, float64(1.11))
189 test_xpath_eval(t, empty_example, `number("10") > 10`, false)
190 test_xpath_eval(t, empty_example, `number("10") = 10`, true)
191 test_xpath_eval(t, empty_example, `number("123") < 1000`, true)
192 test_xpath_eval(t, empty_example, `number(//non-existent-node) = 0`, false)
193 assertTrue(t, math.IsNaN(MustCompile(`number(//non-existent-node)`).Evaluate(createNavigator(empty_example)).(float64)))
194 assertTrue(t, math.IsNaN(MustCompile(`number("123a")`).Evaluate(createNavigator(empty_example)).(float64)))
195}
196
197func Test_func_position(t *testing.T) {
198 test_xpath_elements(t, book_example, `//book[position() = 1]`, 3)

Callers

nothing calls this directly

Calls 5

test_xpath_evalFunction · 0.85
assertTrueFunction · 0.85
MustCompileFunction · 0.85
createNavigatorFunction · 0.85
EvaluateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…