Skip to content

Commit

Permalink
Move tests that include ion data into locations under an ion subpath
Browse files Browse the repository at this point in the history
  • Loading branch information
jpschorr committed Oct 24, 2024
1 parent 9467d28 commit 9b1d13b
Show file tree
Hide file tree
Showing 43 changed files with 1,824 additions and 1,462 deletions.
134 changes: 134 additions & 0 deletions partiql-tests-data/eval/ion/primitives/cast.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
'cast-to-int'::[
{
name:"cast to int valid cases{value:\"`-9223372036854775808e0`\",result:-9223372036854775808}",
statement:"cast(`-9223372036854775808e0` as BIGINT)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:-9223372036854775808
}
},
{
name:"cast to int valid cases{value:\" `\\\"100\\\"` \",result:100}",
statement:"cast( `\"100\"` as INT)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:100
}
},
]

cast_invalid::[
{
name:"cast to int invalid target type{value:\"`2017T`\",target:\"TIMESTAMP\"}",
statement:"cast(`2017T` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\" `{{\\\"\\\"}}` \",target:\"CLOB\"}",
statement:"cast( `{{\"\"}}` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\" `{{\\\"1\\\"}}` \",target:\"CLOB\"}",
statement:"cast( `{{\"1\"}}` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\"`{{}}`\",target:\"BLOB\"}",
statement:"cast(`{{}}` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\"`(1 2)`\",target:\"SEXP\"}",
statement:"cast(`(1 2)` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\"`(1)`\",target:\"SEXP\"}",
statement:"cast(`(1)` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
{
name:"cast to int invalid target type{value:\"`()`\",target:\"SEXP\"}",
statement:"cast(`()` as INT)",
assert:[
{
evalMode:EvalModeError,
result:EvaluationFail
},
{
result:EvaluationSuccess,
evalMode:EvalModeCoerce,
output:$missing::null
}
],
},
]
146 changes: 146 additions & 0 deletions partiql-tests-data/eval/ion/primitives/functions/abs.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
abs::[
{
name:"ABS(`1d0`) Ion DECIMAL",
statement:"ABS(`1d0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:1d0
}
},
{
name:"ABS(`1e0`) Ion FLOAT",
statement:"ABS(`1e0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:1e0
}
},
{
name:"ABS(`-1d0`)",
statement:"ABS(`-1d0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:1d0
}
},
{
name:"ABS(`-1e0`)",
statement:"ABS(`-1e0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:1e0
}
},
{
name:"ABS(`-0.`)",
statement:"ABS(`-0.`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:0d0
}
},
{
name:"ABS(`-0d0`)",
statement:"ABS(`-0d0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:0d0
}
},
{
name:"ABS(`-0d-0`)",
statement:"ABS(`-0d-0`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:0d0
}
},
{
name:"ABS(`-0.0d1`)",
statement:"ABS(`-0.0d1`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:0d0
}
},
{
name:"ABS(`-0.0000`) preserve scale",
statement:"ABS(`-0.0000`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:0d-4
}
},
{
name:"ABS(`-inf`) special value",
statement:"ABS(`-inf`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:+inf
}
},
{
name:"ABS(`+inf`) special value",
statement:"ABS(`+inf`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:+inf
}
},
{
name:"ABS(`nan`) special value",
statement:"ABS(`nan`)",
assert:{
result:EvaluationSuccess,
evalMode:[
EvalModeCoerce,
EvalModeError
],
output:nan
}
},
]
Loading

0 comments on commit 9b1d13b

Please sign in to comment.