13 ["0d0", ion\Type::Decimal],
14 ["1.23", ion\Type::Decimal],
15 ["abc", ion\Type::Symbol],
16 ["()", ion\Type::SExp],
23 ["foo::1", false, "bar"],
24 ["foo::1", true, "foo"],
32 "step" => ["{a:b}", true],
36 "step" => ["{a:b}", "a"],
38 "getFieldNameSymbol" => [
39 ["{a:b}", new ion\Symbol("")],
40 "step" => ["{a:b}", new ion\Symbol("a")],
43 ["foo::bar::1", ["foo", "bar"]],
46 "getAnnotationSymbols" => [
47 ["f::b::1", [new ion\Symbol("f"), new ion\Symbol("b")]],
50 "countAnnotations" => [
55 ["foo::bar::1", "bar", 1],
57 "getAnnotationSymbol" => [
58 ["foo::bar::1", new ion\Symbol("foo"), 0],
61 ["null.int", ion\Type::Int],
62 ["null", ion\Type::Null],
71 [PHP_INT_MAX, PHP_INT_MAX],
72 [PHP_INT_MIN, PHP_INT_MIN],
78 ["1.23", new ion\Decimal("1.23")],
81 ["2003-05T", new ion\Timestamp(ion\Timestamp\Precision::Month, "!Y-m", "2003-05")],
84 ["abc", new ion\Symbol("abc")],
90 ["{{'''abcdef'''}}", "abcdef"],
102 "step" => ["{a:b}", false],
104 "getValueOffset" => [
106 "step" => ["{ab:'''cdefgh'''", 4],
108 "getValueLength" => [ // always returns -1 for text readers
110 "step" => ["{ab:'''cdefgh'''", -1],
114 foreach ($tests as $test => $specs) {
115 foreach ($specs as $prep => $spec) {
116 [$data, $check] = $spec;
117 $args = array_slice($spec, 2);
119 $r = new ion\Reader\Buffer\Reader($data);
123 case "step": $r->getChildren(); /* fall through */
124 case "next": $r->next(); break;
126 $result = $r->$test(...$args);
127 } catch (Throwable $e) {
131 if ($check != $result) {
132 echo "$test@$prep\n";
133 var_dump(compact("check", "result"));
134 var_dump((string)$result);