mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-25 00:48:56 +00:00
absent-handling UT
This commit is contained in:
parent
10a5eaaae8
commit
2970028a78
6 changed files with 131 additions and 805 deletions
|
|
@ -1757,6 +1757,18 @@ mv_t b_x_isnotnull_func(mv_t* pval1) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
mv_t b_x_isabsent_func(mv_t* pval1) {
|
||||
mv_t rv = mv_from_bool(mv_is_absent(pval1));
|
||||
mv_free(pval1);
|
||||
return rv;
|
||||
}
|
||||
mv_t b_x_ispresent_func(mv_t* pval1) {
|
||||
mv_t rv = mv_from_bool(mv_is_present(pval1));
|
||||
mv_free(pval1);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
static mv_t boolean_v_x(mv_t* pa) { return mv_void(); }
|
||||
static mv_t boolean_e_x(mv_t* pa) { return mv_error(); }
|
||||
|
|
|
|||
|
|
@ -213,6 +213,12 @@ static inline int mv_is_null_or_error(mv_t* pval) {
|
|||
static inline int mv_is_non_null(mv_t* pval) {
|
||||
return MT_ERROR < pval->type && pval->type > MT_VOID;
|
||||
}
|
||||
static inline int mv_is_absent(mv_t* pval) {
|
||||
return pval->type == MT_ABSENT;
|
||||
}
|
||||
static inline int mv_is_present(mv_t* pval) {
|
||||
return pval->type != MT_ABSENT;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// AUXILIARY METHODS
|
||||
|
|
@ -320,6 +326,8 @@ mv_t x_xx_roundm_func(mv_t* pval1, mv_t* pval2);
|
|||
|
||||
mv_t b_x_isnull_func(mv_t* pval1);
|
||||
mv_t b_x_isnotnull_func(mv_t* pval1);
|
||||
mv_t b_x_isabsent_func(mv_t* pval1);
|
||||
mv_t b_x_ispresent_func(mv_t* pval1);
|
||||
mv_t i_x_int_func(mv_t* pval1);
|
||||
mv_t f_x_float_func(mv_t* pval1);
|
||||
mv_t b_x_boolean_func(mv_t* pval1);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ function_lookup_t FUNCTION_LOOKUP_TABLE[] = {
|
|||
|
||||
{FUNC_CLASS_CONVERSION, "isnull", 1, "True if argument is null, false otherwise"},
|
||||
{FUNC_CLASS_CONVERSION, "isnotnull", 1, "False if argument is null, true otherwise."},
|
||||
{FUNC_CLASS_CONVERSION, "isabsent", 1, "False if field is present in input, false otherwise"},
|
||||
{FUNC_CLASS_CONVERSION, "ispresent", 1, "True if field is present in input, false otherwise."},
|
||||
{FUNC_CLASS_CONVERSION, "boolean", 1, "Convert int/float/bool/string to boolean."},
|
||||
{FUNC_CLASS_CONVERSION, "float", 1, "Convert int/float/bool/string to float."},
|
||||
{FUNC_CLASS_CONVERSION, "fmtnum", 2,
|
||||
|
|
@ -335,8 +337,10 @@ rval_evaluator_t* rval_evaluator_alloc_from_unary_func_name(char* fnnm, rval_eva
|
|||
} else if (streq(fnnm, "hms2sec")) { return rval_evaluator_alloc_from_f_s_func(i_s_hms2sec_func, parg1);
|
||||
} else if (streq(fnnm, "int")) { return rval_evaluator_alloc_from_x_x_func(i_x_int_func, parg1);
|
||||
} else if (streq(fnnm, "invqnorm")) { return rval_evaluator_alloc_from_f_f_func(f_f_invqnorm_func, parg1);
|
||||
} else if (streq(fnnm, "isabsent")) { return rval_evaluator_alloc_from_x_x_func(b_x_isabsent_func, parg1);
|
||||
} else if (streq(fnnm, "isnotnull")) { return rval_evaluator_alloc_from_x_x_func(b_x_isnotnull_func, parg1);
|
||||
} else if (streq(fnnm, "isnull")) { return rval_evaluator_alloc_from_x_x_func(b_x_isnull_func, parg1);
|
||||
} else if (streq(fnnm, "ispresent")) { return rval_evaluator_alloc_from_x_x_func(b_x_ispresent_func, parg1);
|
||||
} else if (streq(fnnm, "log")) { return rval_evaluator_alloc_from_f_f_func(f_f_log_func, parg1);
|
||||
} else if (streq(fnnm, "log10")) { return rval_evaluator_alloc_from_f_f_func(f_f_log10_func, parg1);
|
||||
} else if (streq(fnnm, "log1p")) { return rval_evaluator_alloc_from_f_f_func(f_f_log1p_func, parg1);
|
||||
|
|
@ -351,11 +355,11 @@ rval_evaluator_t* rval_evaluator_alloc_from_unary_func_name(char* fnnm, rval_eva
|
|||
} else if (streq(fnnm, "sqrt")) { return rval_evaluator_alloc_from_f_f_func(f_f_sqrt_func, parg1);
|
||||
} else if (streq(fnnm, "string")) { return rval_evaluator_alloc_from_x_x_func(s_x_string_func, parg1);
|
||||
} else if (streq(fnnm, "strlen")) { return rval_evaluator_alloc_from_i_s_func(i_s_strlen_func, parg1);
|
||||
} else if (streq(fnnm, "typeof")) { return rval_evaluator_alloc_from_x_x_func(s_x_typeof_func, parg1);
|
||||
} else if (streq(fnnm, "tan")) { return rval_evaluator_alloc_from_f_f_func(f_f_tan_func, parg1);
|
||||
} else if (streq(fnnm, "tanh")) { return rval_evaluator_alloc_from_f_f_func(f_f_tanh_func, parg1);
|
||||
} else if (streq(fnnm, "tolower")) { return rval_evaluator_alloc_from_s_s_func(s_s_tolower_func, parg1);
|
||||
} else if (streq(fnnm, "toupper")) { return rval_evaluator_alloc_from_s_s_func(s_s_toupper_func, parg1);
|
||||
} else if (streq(fnnm, "typeof")) { return rval_evaluator_alloc_from_x_x_func(s_x_typeof_func, parg1);
|
||||
|
||||
} else return NULL;
|
||||
}
|
||||
|
|
|
|||
683
c/output/out-dev
683
c/output/out-dev
|
|
@ -3,653 +3,6 @@
|
|||
OLD NULL-HANDLING
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $z = $x + $y ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,z=3
|
||||
x=1,y=,s=,z=
|
||||
x=,y=,s=hurrah,z=
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $z = $y + $y ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,z=4
|
||||
x=1,y=,s=,z=
|
||||
x=,y=,s=hurrah,z=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME FOR SRECS
|
||||
mlr put $z = $x + $nosuch ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,z=1
|
||||
x=1,y=,s=,z=1
|
||||
x=,y=,s=hurrah,z=
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = sub($s, "ell", "X") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=hXo
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=hurrah
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = sub($s, "ell", "") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=ho
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=hurrah
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = sub($nosuch, "ell", "X") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = gsub($s, "l", "X") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=heXXo
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=hurrah
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = gsub($s, "l", "") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=heo
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=hurrah
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $t = gsub($nosuch, "l", "X") ./reg_test/input/null-vs-empty.dkvp
|
||||
x=1,y=2,s=hello,t=
|
||||
x=1,y=,s=,t=
|
||||
x=,y=,s=hurrah,t=
|
||||
|
||||
|
||||
================================================================
|
||||
NULLITY PREDICATES
|
||||
|
||||
mlr --opprint filter isnull($x) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b - 6 -
|
||||
b - - -
|
||||
|
||||
mlr --opprint filter isnull($y) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b 5 - -
|
||||
b - - -
|
||||
|
||||
mlr --opprint filter isnull($z) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b 1 2 -
|
||||
b 3 4 -
|
||||
b 5 - -
|
||||
b - 6 -
|
||||
b - - -
|
||||
|
||||
mlr --opprint filter isnull($nosuch) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b 1 2 -
|
||||
b 3 4 -
|
||||
b 5 - -
|
||||
b - 6 -
|
||||
b - - -
|
||||
|
||||
mlr --opprint filter isnotnull($x) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b 1 2 -
|
||||
b 3 4 -
|
||||
b 5 - -
|
||||
|
||||
mlr --opprint filter isnotnull($y) ./reg_test/input/nullvals.dkvp
|
||||
a x y z
|
||||
b 1 2 -
|
||||
b 3 4 -
|
||||
b - 6 -
|
||||
|
||||
mlr --opprint filter isnotnull($z) ./reg_test/input/nullvals.dkvp
|
||||
|
||||
mlr --opprint filter isnotnull($nosuch) ./reg_test/input/nullvals.dkvp
|
||||
|
||||
mlr --opprint put $f=isnull($x) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - false
|
||||
b 3 4 - false
|
||||
b 5 - - false
|
||||
b - 6 - true
|
||||
b - - - true
|
||||
|
||||
mlr --opprint put $f=isnull($y) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - false
|
||||
b 3 4 - false
|
||||
b 5 - - true
|
||||
b - 6 - false
|
||||
b - - - true
|
||||
|
||||
mlr --opprint put $f=isnull($z) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - true
|
||||
b 3 4 - true
|
||||
b 5 - - true
|
||||
b - 6 - true
|
||||
b - - - true
|
||||
|
||||
mlr --opprint put $f=isnull($nosuch) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - true
|
||||
b 3 4 - true
|
||||
b 5 - - true
|
||||
b - 6 - true
|
||||
b - - - true
|
||||
|
||||
mlr --opprint put $f=isnotnull($x) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - true
|
||||
b 3 4 - true
|
||||
b 5 - - true
|
||||
b - 6 - false
|
||||
b - - - false
|
||||
|
||||
mlr --opprint put $f=isnotnull($y) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - true
|
||||
b 3 4 - true
|
||||
b 5 - - false
|
||||
b - 6 - true
|
||||
b - - - false
|
||||
|
||||
mlr --opprint put $f=isnotnull($z) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - false
|
||||
b 3 4 - false
|
||||
b 5 - - false
|
||||
b - 6 - false
|
||||
b - - - false
|
||||
|
||||
mlr --opprint put $f=isnotnull($nosuch) ./reg_test/input/nullvals.dkvp
|
||||
a x y z f
|
||||
b 1 2 - false
|
||||
b 3 4 - false
|
||||
b 5 - - false
|
||||
b - 6 - false
|
||||
b - - - false
|
||||
|
||||
|
||||
================================================================
|
||||
TRI-SPLIT-NULL HANDLING
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum += $x; end{emitp @sum} ./reg_test/input/abixy
|
||||
sum=4.536294
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum[$a] += $x; end{emitp @sum, "a"} ./reg_test/input/abixy
|
||||
a=pan,sum=0.849416
|
||||
a=eks,sum=1.751863
|
||||
a=wye,sum=0.777892
|
||||
a=zee,sum=1.125680
|
||||
a=hat,sum=0.031442
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $nonesuch = @nonesuch ./reg_test/input/abixy
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,nonesuch=
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,nonesuch=
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,nonesuch=
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,nonesuch=
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,nonesuch=
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,nonesuch=
|
||||
a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,nonesuch=
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,nonesuch=
|
||||
a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,nonesuch=
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,nonesuch=
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum += $x; end{emitp @sum} ./reg_test/input/abixy-het
|
||||
sum=3.963005
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum[$a] += $x; end{emitp @sum, "a"} ./reg_test/input/abixy-het
|
||||
a=pan,sum=0.849416
|
||||
a=eks,sum=1.751863
|
||||
a=wye,sum=
|
||||
a=zee,sum=1.125680
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $nonesuch = @nonesuch ./reg_test/input/abixy-het
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,nonesuch=
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,nonesuch=
|
||||
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,nonesuch=
|
||||
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,nonesuch=
|
||||
a=wye,b=pan,i=5,xxx=0.5732889198020006,y=0.8636244699032729,nonesuch=
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,nonesuch=
|
||||
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,nonesuch=
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006,nonesuch=
|
||||
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,nonesuch=
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,nonesuch=
|
||||
|
||||
mlr put -q @sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum} ./reg_test/input/abixy
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=0.346790
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.105470
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.310073
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.691473
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=2.264762
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=2.791888
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=3.403672
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=4.002226
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=4.033668
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=4.536294
|
||||
sum=4.536294
|
||||
|
||||
mlr put -q @sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum} ./reg_test/input/abixy-het
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=0.346790
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.105470
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.310073
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=1.691473
|
||||
sumtype=MT_FLOAT,xtype=MT_ABSENT,sum=1.691473
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=2.218599
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=2.830383
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=3.428937
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=3.460379
|
||||
sumtype=MT_FLOAT,xtype=MT_FLOAT,sum=3.963005
|
||||
sum=3.963005
|
||||
|
||||
mlr put $z = $x + $y ./reg_test/input/typeof.dkvp
|
||||
x=1,y=2,z=3
|
||||
x=1,y=,z=
|
||||
x=,y=2,z=
|
||||
x=,y=,z=
|
||||
|
||||
mlr put $z = $x + $y ./reg_test/input/typeof.dkvp
|
||||
x=1,y=2,z=3
|
||||
x=1,y=,z=
|
||||
x=,y=2,z=
|
||||
x=,y=,z=
|
||||
|
||||
mlr put $z = $x + $u ./reg_test/input/typeof.dkvp
|
||||
x=1,y=2,z=1
|
||||
x=1,y=,z=1
|
||||
x=,y=2,z=
|
||||
x=,y=,z=
|
||||
|
||||
mlr put @s = @s + $y; emitp @s ./reg_test/input/typeof.dkvp
|
||||
s=2
|
||||
x=1,y=2
|
||||
s=
|
||||
x=1,y=
|
||||
s=
|
||||
x=,y=2
|
||||
s=
|
||||
x=,y=
|
||||
|
||||
mlr put @s = @s + $y; emitp @s ./reg_test/input/typeof.dkvp
|
||||
s=2
|
||||
x=1,y=2
|
||||
s=
|
||||
x=1,y=
|
||||
s=
|
||||
x=,y=2
|
||||
s=
|
||||
x=,y=
|
||||
|
||||
mlr put @s = @s + $u; emitp @s ./reg_test/input/typeof.dkvp
|
||||
s=
|
||||
x=1,y=2
|
||||
s=
|
||||
x=1,y=
|
||||
s=
|
||||
x=,y=2
|
||||
s=
|
||||
x=,y=
|
||||
|
||||
mlr put $z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_INT
|
||||
x=MT_INT,y=MT_VOID,z=MT_VOID
|
||||
x=MT_VOID,y=MT_INT,z=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_VOID
|
||||
|
||||
mlr put $z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_INT
|
||||
x=MT_INT,y=MT_VOID,z=MT_VOID
|
||||
x=MT_VOID,y=MT_INT,z=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_VOID
|
||||
|
||||
mlr put $z = $x + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_INT
|
||||
x=MT_INT,y=MT_VOID,z=MT_INT
|
||||
x=MT_VOID,y=MT_INT,z=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_VOID
|
||||
|
||||
mlr put @s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_ABSENT,s=MT_INT
|
||||
x=MT_INT,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_INT,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
|
||||
mlr put @s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_ABSENT,s=MT_INT
|
||||
x=MT_INT,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_INT,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
|
||||
mlr put @s = @s + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s) ./reg_test/input/typeof.dkvp
|
||||
x=MT_INT,y=MT_INT,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_INT,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_INT,z=MT_ABSENT,s=MT_VOID
|
||||
x=MT_VOID,y=MT_VOID,z=MT_ABSENT,s=MT_VOID
|
||||
|
||||
|
||||
================================================================
|
||||
ABSENT-HANDLING
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME FOR SRECS
|
||||
mlr put $a = $a * 2 ./reg_test/input/absent.dkvp
|
||||
a=2,b=2
|
||||
a=,b=4
|
||||
x=,b=6,a=2
|
||||
a=14,b=8
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME FOR SRECS
|
||||
mlr put $new = $a * 2 ./reg_test/input/absent.dkvp
|
||||
a=1,b=2,new=2
|
||||
a=,b=4,new=
|
||||
x=,b=6,new=2
|
||||
a=7,b=8,new=14
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok for oosvars
|
||||
mlr put $new = @nonesuch * 2 ./reg_test/input/absent.dkvp
|
||||
a=1,b=2,new=2
|
||||
a=,b=4,new=2
|
||||
x=,b=6,new=2
|
||||
a=7,b=8,new=2
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put begin {@somesuch = 10 }; $new = @somesuch * 2 ./reg_test/input/absent.dkvp
|
||||
a=1,b=2,new=20
|
||||
a=,b=4,new=20
|
||||
x=,b=6,new=20
|
||||
a=7,b=8,new=20
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME FOR SRECS
|
||||
mlr put $new = @nonesuch * $a ./reg_test/input/absent.dkvp
|
||||
a=1,b=2,new=1
|
||||
a=,b=4,new=
|
||||
x=,b=6,new=
|
||||
a=7,b=8,new=7
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put begin {@somesuch = 10 }; $new = @somesuch * $a ./reg_test/input/absent.dkvp
|
||||
a=1,b=2,new=10
|
||||
a=,b=4,new=
|
||||
x=,b=6,new=10
|
||||
a=7,b=8,new=70
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put @sum = @sum + $a; emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=1
|
||||
a=1,b=2
|
||||
sum=
|
||||
a=,b=4
|
||||
sum=
|
||||
x=,b=6
|
||||
sum=
|
||||
a=7,b=8
|
||||
sum=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put @product = @product * $a; emit @product; end { emit @product } ./reg_test/input/absent.dkvp
|
||||
product=1
|
||||
a=1,b=2
|
||||
product=
|
||||
a=,b=4
|
||||
product=
|
||||
x=,b=6
|
||||
product=
|
||||
a=7,b=8
|
||||
product=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put begin { @sum = 10 }; @sum = @sum + $a; emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=11
|
||||
a=1,b=2
|
||||
sum=
|
||||
a=,b=4
|
||||
sum=
|
||||
x=,b=6
|
||||
sum=
|
||||
a=7,b=8
|
||||
sum=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put begin { @product = 10 }; @product = @product * $a; emit @product; end { emit @product } ./reg_test/input/absent.dkvp
|
||||
product=10
|
||||
a=1,b=2
|
||||
product=
|
||||
a=,b=4
|
||||
product=
|
||||
x=,b=6
|
||||
product=
|
||||
a=7,b=8
|
||||
product=
|
||||
|
||||
|
||||
================================================================
|
||||
COMPARE OLD TESTS TO NEW
|
||||
|
||||
|
||||
---------------------------------------------------------------- raw input
|
||||
mlr cat ./reg_test/input/abixy-het
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,xxx=0.5732889198020006,y=0.8636244699032729
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
|
||||
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum += $x; end{emitp @sum} ./reg_test/input/abixy-het
|
||||
sum=3.963005
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put -q @sum[$a] += $x; end{emitp @sum, "a"} ./reg_test/input/abixy-het
|
||||
a=pan,sum=0.849416
|
||||
a=eks,sum=1.751863
|
||||
a=wye,sum=
|
||||
a=zee,sum=1.125680
|
||||
|
||||
|
||||
---------------------------------------------------------------- ok
|
||||
mlr put $nonesuch = @nonesuch ./reg_test/input/abixy-het
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,nonesuch=
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,nonesuch=
|
||||
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,nonesuch=
|
||||
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,nonesuch=
|
||||
a=wye,b=pan,i=5,xxx=0.5732889198020006,y=0.8636244699032729,nonesuch=
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,nonesuch=
|
||||
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,nonesuch=
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006,nonesuch=
|
||||
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,nonesuch=
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,nonesuch=
|
||||
|
||||
|
||||
---------------------------------------------------------------- raw input
|
||||
mlr cat ./reg_test/input/absent.dkvp
|
||||
a=1,b=2
|
||||
a=,b=4
|
||||
x=,b=6
|
||||
a=7,b=8
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put @sum = @sum + $a; emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=1
|
||||
a=1,b=2
|
||||
sum=
|
||||
a=,b=4
|
||||
sum=
|
||||
x=,b=6
|
||||
sum=
|
||||
a=7,b=8
|
||||
sum=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put @product = @product * $a; emit @product; end { emit @product } ./reg_test/input/absent.dkvp
|
||||
product=1
|
||||
a=1,b=2
|
||||
product=
|
||||
a=,b=4
|
||||
product=
|
||||
x=,b=6
|
||||
product=
|
||||
a=7,b=8
|
||||
product=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put begin { @sum = 10 }; @sum = @sum + $a; emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=11
|
||||
a=1,b=2
|
||||
sum=
|
||||
a=,b=4
|
||||
sum=
|
||||
x=,b=6
|
||||
sum=
|
||||
a=7,b=8
|
||||
sum=
|
||||
|
||||
|
||||
---------------------------------------------------------------- FIXME AND COMPARE TO ABOVE
|
||||
mlr put begin { @product = 10 }; @product = @product * $a; emit @product; end { emit @product } ./reg_test/input/absent.dkvp
|
||||
product=10
|
||||
a=1,b=2
|
||||
product=
|
||||
a=,b=4
|
||||
product=
|
||||
x=,b=6
|
||||
product=
|
||||
a=7,b=8
|
||||
product=
|
||||
|
||||
|
||||
---------------------------------------------------------------- COMPARE
|
||||
mlr put emit @sum; @sum += $x; emit @sum; end { emit @sum } ./reg_test/input/abixy-het
|
||||
sum=0.346790
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
sum=0.346790
|
||||
sum=1.105470
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
sum=1.105470
|
||||
sum=1.310073
|
||||
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
sum=1.310073
|
||||
sum=1.691473
|
||||
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
sum=1.691473
|
||||
sum=1.691473
|
||||
a=wye,b=pan,i=5,xxx=0.5732889198020006,y=0.8636244699032729
|
||||
sum=1.691473
|
||||
sum=2.218599
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
sum=2.218599
|
||||
sum=2.830383
|
||||
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
sum=2.830383
|
||||
sum=3.428937
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
|
||||
sum=3.428937
|
||||
sum=3.460379
|
||||
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
sum=3.460379
|
||||
sum=3.963005
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
sum=3.963005
|
||||
|
||||
|
||||
---------------------------------------------------------------- COMPARE
|
||||
mlr put emit @sum; @sum += $a; emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=1
|
||||
a=1,b=2
|
||||
sum=1
|
||||
sum=
|
||||
a=,b=4
|
||||
sum=
|
||||
sum=
|
||||
x=,b=6
|
||||
sum=
|
||||
sum=
|
||||
a=7,b=8
|
||||
sum=
|
||||
|
||||
mlr put emit @sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);emit @sum; end { emit @sum } ./reg_test/input/abixy-het
|
||||
sum=0.346790
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,ostype=MT_UNINIT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=0.346790
|
||||
sum=1.105470
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=1.105470
|
||||
sum=1.310073
|
||||
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=1.310073
|
||||
sum=1.691473
|
||||
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=1.691473
|
||||
sum=1.691473
|
||||
a=wye,b=pan,i=5,xxx=0.5732889198020006,y=0.8636244699032729,ostype=MT_FLOAT,xtype=MT_ABSENT,nstype=MT_FLOAT
|
||||
sum=1.691473
|
||||
sum=2.218599
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=2.218599
|
||||
sum=2.830383
|
||||
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=2.830383
|
||||
sum=3.428937
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=3.428937
|
||||
sum=3.460379
|
||||
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=3.460379
|
||||
sum=3.963005
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,ostype=MT_FLOAT,xtype=MT_FLOAT,nstype=MT_FLOAT
|
||||
sum=3.963005
|
||||
|
||||
mlr put emit @sum; $ostype=typeof(@sum);$atype=typeof($a);@sum += $a; $nstype=typeof(@sum);emit @sum; end { emit @sum } ./reg_test/input/absent.dkvp
|
||||
sum=1
|
||||
a=1,b=2,ostype=MT_UNINIT,atype=MT_INT,nstype=MT_INT
|
||||
sum=1
|
||||
sum=
|
||||
a=,b=4,ostype=MT_INT,atype=MT_VOID,nstype=MT_VOID
|
||||
sum=
|
||||
sum=
|
||||
x=,b=6,ostype=MT_VOID,atype=MT_ABSENT,nstype=MT_VOID
|
||||
sum=
|
||||
sum=
|
||||
a=7,b=8,ostype=MT_VOID,atype=MT_INT,nstype=MT_VOID
|
||||
sum=
|
||||
|
||||
|
||||
================================================================
|
||||
NARROW IN
|
||||
|
||||
|
|
@ -660,10 +13,16 @@ x=1
|
|||
x=
|
||||
x=7
|
||||
|
||||
mlr put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1,osum=,ostype=MT_UNINIT,xtype=MT_INT,nstype=MT_INT,nsum=1
|
||||
x=,osum=1,ostype=MT_INT,xtype=MT_VOID,nstype=MT_VOID,nsum=
|
||||
x=7,osum=,ostype=MT_VOID,xtype=MT_INT,nstype=MT_VOID,nsum=
|
||||
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
||||
x= osum=1 ostype=MT_INT xtype=MT_VOID nstype=MT_VOID nsum=
|
||||
x=7 osum= ostype=MT_VOID xtype=MT_INT nstype=MT_VOID nsum=
|
||||
sum=
|
||||
|
||||
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
||||
x= osum=1 ostype=MT_INT xtype=MT_VOID nstype=MT_VOID nsum=
|
||||
x=7 osum= ostype=MT_VOID xtype=MT_INT nstype=MT_VOID nsum=
|
||||
sum=
|
||||
|
||||
|
||||
|
|
@ -673,10 +32,16 @@ x=1
|
|||
xxx=
|
||||
x=7
|
||||
|
||||
mlr put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1,osum=,ostype=MT_UNINIT,xtype=MT_INT,nstype=MT_INT,nsum=1
|
||||
xxx=,osum=1,ostype=MT_INT,xtype=MT_ABSENT,nstype=MT_INT,nsum=1
|
||||
x=7,osum=1,ostype=MT_INT,xtype=MT_INT,nstype=MT_INT,nsum=8
|
||||
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
||||
xxx= osum=1 ostype=MT_INT xtype=MT_ABSENT nstype=MT_ABSENT nsum=
|
||||
x=7 osum= ostype=MT_ABSENT xtype=MT_INT nstype=MT_ABSENT nsum=
|
||||
sum=
|
||||
|
||||
mlr --ofs tab put $osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }
|
||||
x=1 osum= ostype=MT_UNINIT xtype=MT_INT nstype=MT_INT nsum=1
|
||||
xxx= osum=1 ostype=MT_INT xtype=MT_ABSENT nstype=MT_INT nsum=1
|
||||
x=7 osum=1 ostype=MT_INT xtype=MT_INT nstype=MT_INT nsum=8
|
||||
sum=8
|
||||
|
||||
|
||||
|
|
@ -690,6 +55,12 @@ x=7
|
|||
mlr --ofs tab put $xtype=typeof($x);$sum = $x + 10; $stype=typeof($sum)
|
||||
x=1 xtype=MT_INT sum=11 stype=MT_INT
|
||||
x= xtype=MT_VOID sum= stype=MT_VOID
|
||||
y= xtype=MT_ABSENT sum=10 stype=MT_INT
|
||||
y= xtype=MT_ABSENT sum= stype=MT_ABSENT
|
||||
x=7 xtype=MT_INT sum=17 stype=MT_INT
|
||||
|
||||
mlr --ofs tab put $xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)
|
||||
x=1 xtype=MT_INT sum=11 stype=MT_INT
|
||||
x= xtype=MT_VOID sum= stype=MT_VOID
|
||||
y= xtype=MT_ABSENT sum=999 stype=MT_INT
|
||||
x=7 xtype=MT_INT sum=17 stype=MT_INT
|
||||
|
||||
|
|
|
|||
169
c/reg_test/dev
169
c/reg_test/dev
|
|
@ -76,152 +76,6 @@ run_mlr() {
|
|||
# ================================================================
|
||||
announce OLD NULL-HANDLING
|
||||
|
||||
mention ok
|
||||
run_mlr put '$z = $x + $y' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$z = $y + $y' $indir/null-vs-empty.dkvp
|
||||
mention FIXME FOR SRECS
|
||||
run_mlr put '$z = $x + $nosuch' $indir/null-vs-empty.dkvp
|
||||
|
||||
mention ok
|
||||
run_mlr put '$t = sub($s, "ell", "X")' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$t = sub($s, "ell", "")' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$t = sub($nosuch, "ell", "X")' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$t = gsub($s, "l", "X")' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$t = gsub($s, "l", "")' $indir/null-vs-empty.dkvp
|
||||
mention ok
|
||||
run_mlr put '$t = gsub($nosuch, "l", "X")' $indir/null-vs-empty.dkvp
|
||||
|
||||
# ================================================================
|
||||
announce NULLITY PREDICATES
|
||||
|
||||
run_mlr --opprint filter 'isnull($x)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnull($y)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnull($z)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnull($nosuch)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnotnull($x)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnotnull($y)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnotnull($z)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint filter 'isnotnull($nosuch)' $indir/nullvals.dkvp
|
||||
|
||||
run_mlr --opprint put '$f=isnull($x)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnull($y)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnull($z)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnull($nosuch)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnotnull($x)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnotnull($y)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnotnull($z)' $indir/nullvals.dkvp
|
||||
run_mlr --opprint put '$f=isnotnull($nosuch)' $indir/nullvals.dkvp
|
||||
|
||||
# ================================================================
|
||||
announce TRI-SPLIT-NULL HANDLING
|
||||
|
||||
mention ok
|
||||
run_mlr put -q '@sum += $x; end{emitp @sum}' $indir/abixy
|
||||
mention ok
|
||||
run_mlr put -q '@sum[$a] += $x; end{emitp @sum, "a"}' $indir/abixy
|
||||
mention ok
|
||||
run_mlr put '$nonesuch = @nonesuch' $indir/abixy
|
||||
|
||||
mention ok
|
||||
run_mlr put -q '@sum += $x; end{emitp @sum}' $indir/abixy-het
|
||||
mention ok
|
||||
run_mlr put -q '@sum[$a] += $x; end{emitp @sum, "a"}' $indir/abixy-het
|
||||
mention ok
|
||||
run_mlr put '$nonesuch = @nonesuch' $indir/abixy-het
|
||||
|
||||
run_mlr put -q '@sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum}' $indir/abixy
|
||||
run_mlr put -q '@sum += $x; @sumtype = typeof(@sum); @xtype = typeof($x); emitf @sumtype, @xtype, @sum; end{emitp @sum}' $indir/abixy-het
|
||||
|
||||
run_mlr put '$z = $x + $y' $indir/typeof.dkvp
|
||||
run_mlr put '$z = $x + $y' $indir/typeof.dkvp
|
||||
run_mlr put '$z = $x + $u' $indir/typeof.dkvp
|
||||
|
||||
run_mlr put '@s = @s + $y; emitp @s' $indir/typeof.dkvp
|
||||
run_mlr put '@s = @s + $y; emitp @s' $indir/typeof.dkvp
|
||||
run_mlr put '@s = @s + $u; emitp @s' $indir/typeof.dkvp
|
||||
|
||||
run_mlr put '$z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)' $indir/typeof.dkvp
|
||||
run_mlr put '$z = $x + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z)' $indir/typeof.dkvp
|
||||
run_mlr put '$z = $x + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z)' $indir/typeof.dkvp
|
||||
|
||||
run_mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp
|
||||
run_mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp
|
||||
run_mlr put '@s = @s + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp
|
||||
|
||||
# ================================================================
|
||||
announce ABSENT-HANDLING
|
||||
|
||||
mention FIXME FOR SRECS
|
||||
run_mlr put '$a = $a * 2' $indir/absent.dkvp
|
||||
|
||||
mention FIXME FOR SRECS
|
||||
run_mlr put '$new = $a * 2' $indir/absent.dkvp
|
||||
|
||||
mention ok for oosvars
|
||||
run_mlr put '$new = @nonesuch * 2' $indir/absent.dkvp
|
||||
|
||||
mention ok
|
||||
run_mlr put 'begin {@somesuch = 10 }; $new = @somesuch * 2' $indir/absent.dkvp
|
||||
|
||||
mention FIXME FOR SRECS
|
||||
run_mlr put '$new = @nonesuch * $a' $indir/absent.dkvp
|
||||
|
||||
mention ok
|
||||
run_mlr put 'begin {@somesuch = 10 }; $new = @somesuch * $a' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put '@sum = @sum + $a; emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put '@product = @product * $a; emit @product; end { emit @product }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put 'begin { @sum = 10 }; @sum = @sum + $a; emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put 'begin { @product = 10 }; @product = @product * $a; emit @product; end { emit @product }' $indir/absent.dkvp
|
||||
|
||||
# ================================================================
|
||||
announce COMPARE OLD TESTS TO NEW
|
||||
|
||||
mention raw input
|
||||
run_mlr cat $indir/abixy-het
|
||||
mention ok
|
||||
run_mlr put -q '@sum += $x; end{emitp @sum}' $indir/abixy-het
|
||||
mention ok
|
||||
run_mlr put -q '@sum[$a] += $x; end{emitp @sum, "a"}' $indir/abixy-het
|
||||
mention ok
|
||||
run_mlr put '$nonesuch = @nonesuch' $indir/abixy-het
|
||||
|
||||
mention raw input
|
||||
run_mlr cat $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put '@sum = @sum + $a; emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put '@product = @product * $a; emit @product; end { emit @product }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put 'begin { @sum = 10 }; @sum = @sum + $a; emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
mention FIXME AND COMPARE TO ABOVE
|
||||
run_mlr put 'begin { @product = 10 }; @product = @product * $a; emit @product; end { emit @product }' $indir/absent.dkvp
|
||||
|
||||
mention COMPARE
|
||||
run_mlr put 'emit @sum; @sum += $x; emit @sum; end { emit @sum }' $indir/abixy-het
|
||||
|
||||
mention COMPARE
|
||||
run_mlr put 'emit @sum; @sum += $a; emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
run_mlr put 'emit @sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);emit @sum; end { emit @sum }' $indir/abixy-het|redden xxx
|
||||
run_mlr put 'emit @sum; $ostype=typeof(@sum);$atype=typeof($a);@sum += $a; $nstype=typeof(@sum);emit @sum; end { emit @sum }' $indir/absent.dkvp
|
||||
|
||||
# ================================================================
|
||||
announce NARROW IN
|
||||
|
||||
|
|
@ -232,7 +86,13 @@ x=
|
|||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
x=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
x=
|
||||
x=7
|
||||
|
|
@ -245,7 +105,13 @@ xxx=
|
|||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum += $x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
xxx=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
xxx=
|
||||
x=7
|
||||
|
|
@ -266,6 +132,13 @@ y=
|
|||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)' <<EOF
|
||||
x=1
|
||||
x=
|
||||
y=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
# ================================================================
|
||||
cat $outfile
|
||||
|
||||
|
|
|
|||
|
|
@ -1335,6 +1335,64 @@ run_mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@
|
|||
run_mlr put '@s = @s + $y; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp
|
||||
run_mlr put '@s = @s + $u; $x=typeof($x);$y=typeof($y);$z=typeof($z);$s=typeof(@s)' $indir/typeof.dkvp
|
||||
|
||||
run_mlr cat << EOF
|
||||
x=1
|
||||
x=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
x=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
x=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr cat << EOF
|
||||
x=1
|
||||
xxx=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);@sum+=$x; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
xxx=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$osum=@sum; $ostype=typeof(@sum);$xtype=typeof($x);ispresent($x){@sum+=$x}; $nstype=typeof(@sum);$nsum=@sum; end { emit @sum }' <<EOF
|
||||
x=1
|
||||
xxx=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr cat << EOF
|
||||
x=1
|
||||
x=
|
||||
y=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$xtype=typeof($x);$sum = $x + 10; $stype=typeof($sum)' <<EOF
|
||||
x=1
|
||||
x=
|
||||
y=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
run_mlr --ofs tab put '$xtype=typeof($x);$sum = ispresent($x) ? $x + 10 : 999; $stype=typeof($sum)' <<EOF
|
||||
x=1
|
||||
x=
|
||||
y=
|
||||
x=7
|
||||
EOF
|
||||
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
announce PARAMETERIZED EMIT
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue