From fec3cff17b936d4dbcdeadb6f8d2fb2ac6fdc8f0 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Tue, 20 Dec 2016 09:30:21 -0500 Subject: [PATCH] assertion UTs --- c/reg_test/expected/out | 5 +-- c/reg_test/run | 2 +- c/todo.txt | 2 + doc/cookbook.html | 90 ++++++++++++++++++++--------------------- 4 files changed, 50 insertions(+), 49 deletions(-) diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index 83f6c3ecf..8b3a19e8d 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -18582,9 +18582,8 @@ mlr: numeric type-assertion failed at NR=1 FNR=1 FILENAME=./reg_test/input/nullv mlr --opprint put $* = asserting_numeric($*) ./reg_test/input/nullvals.dkvp mlr: numeric type-assertion failed at NR=1 FNR=1 FILENAME=./reg_test/input/nullvals.dkvp -mlr --opprint put $* asserting_numeric({1:2}) ./reg_test/input/nullvals.dkvp -mlr DSL: syntax error at "asserting_numeric" -./reg_test/../../c/mlr put: syntax error on DSL parse of '$* asserting_numeric({1:2})' +mlr --opprint put $* = asserting_numeric({1:2}) ./reg_test/input/nullvals.dkvp +mlr: numeric type-assertion failed at NR=1 FNR=1 FILENAME=./reg_test/input/nullvals.dkvp mlr --opprint put $x = asserting_string($x) ./reg_test/input/nullvals.dkvp mlr: string type-assertion failed at NR=1 FNR=1 FILENAME=./reg_test/input/nullvals.dkvp diff --git a/c/reg_test/run b/c/reg_test/run index acf11a5af..396c0c2e9 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -1303,7 +1303,7 @@ mlr_expect_fail --opprint put '$y = asserting_numeric($y)' $in mlr_expect_fail --opprint put '$z = asserting_numeric($z)' $indir/nullvals.dkvp mlr_expect_fail --opprint put '$nosuch = asserting_numeric($nosuch)' $indir/nullvals.dkvp mlr_expect_fail --opprint put '$* = asserting_numeric($*)' $indir/nullvals.dkvp -mlr_expect_fail --opprint put '$* asserting_numeric({1:2})' $indir/nullvals.dkvp +mlr_expect_fail --opprint put '$* = asserting_numeric({1:2})' $indir/nullvals.dkvp mlr_expect_fail --opprint put '$x = asserting_string($x)' $indir/nullvals.dkvp mlr_expect_fail --opprint put '$y = asserting_string($y)' $indir/nullvals.dkvp run_mlr --opprint put '$z = asserting_string($z)' $indir/nullvals.dkvp diff --git a/c/todo.txt b/c/todo.txt index beb6802d6..da0d88e98 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -29,6 +29,8 @@ OTHER: ! sort --fold ! +! true/false/1/0 data-cleaning cookbook section. include filter x 2 (preceded by put $nr=NR), & tee x 2. + ---------------------------------------------------------------- MAPVAR CHECKLIST: diff --git a/doc/cookbook.html b/doc/cookbook.html index fad373d09..b21f7b67d 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -607,33 +607,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000041962 -3 3 5 0.000013113 -4 5 9 0.000015974 -5 8 15 0.000032902 -6 13 25 0.000056982 -7 21 41 0.000046968 -8 34 67 0.000095129 -9 55 109 0.000149965 -10 89 177 0.000176907 -11 144 287 0.000282049 -12 233 465 0.000458002 -13 377 753 0.000953913 -14 610 1219 0.001627207 -15 987 1973 0.002174854 -16 1597 3193 0.003175974 -17 2584 5167 0.005285978 -18 4181 8361 0.008095980 -19 6765 13529 0.014776230 -20 10946 21891 0.020953894 -21 17711 35421 0.034339905 -22 28657 57313 0.057970047 -23 46368 92735 0.089967012 -24 75025 150049 0.152300119 -25 121393 242785 0.227298021 -26 196418 392835 0.353976965 -27 317811 635621 0.580997944 -28 514229 1028457 0.904406071 +2 2 3 0.000025034 +3 3 5 0.000012875 +4 5 9 0.000017166 +5 8 15 0.000021935 +6 13 25 0.000032902 +7 21 41 0.000046015 +8 34 67 0.000070095 +9 55 109 0.000110865 +10 89 177 0.000176191 +11 144 287 0.000280857 +12 233 465 0.000450134 +13 377 753 0.000723839 +14 610 1219 0.001165152 +15 987 1973 0.001885891 +16 1597 3193 0.003230095 +17 2584 5167 0.005661011 +18 4181 8361 0.008404016 +19 6765 13529 0.013396025 +20 10946 21891 0.023089886 +21 17711 35421 0.034012079 +22 28657 57313 0.055222034 +23 46368 92735 0.090658903 +24 75025 150049 0.144522905 +25 121393 242785 0.255508184 +26 196418 392835 0.373664856 +27 317811 635621 0.630728960 +28 514229 1028457 0.989997149

@@ -665,33 +665,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000030041 +2 2 3 0.000036955 3 3 3 0.000013113 4 5 3 0.000010967 -5 8 3 0.000011921 -6 13 3 0.000010967 -7 21 3 0.000010014 -8 34 3 0.000010967 -9 55 3 0.000011206 -10 89 3 0.000010014 -11 144 3 0.000010967 -12 233 3 0.000015020 +5 8 3 0.000010967 +6 13 3 0.000010014 +7 21 3 0.000010967 +8 34 3 0.000010014 +9 55 3 0.000010014 +10 89 3 0.000010967 +11 144 3 0.000010014 +12 233 3 0.000014067 13 377 3 0.000010967 14 610 3 0.000010014 -15 987 3 0.000010967 +15 987 3 0.000010014 16 1597 3 0.000010014 -17 2584 3 0.000010967 +17 2584 3 0.000010014 18 4181 3 0.000010014 -19 6765 3 0.000010967 -20 10946 3 0.000010014 -21 17711 3 0.000011921 -22 28657 3 0.000010967 -23 46368 3 0.000013113 +19 6765 3 0.000010014 +20 10946 3 0.000010967 +21 17711 3 0.000010967 +22 28657 3 0.000010014 +23 46368 3 0.000011921 24 75025 3 0.000010967 25 121393 3 0.000010014 26 196418 3 0.000010967 -27 317811 3 0.000010967 -28 514229 3 0.000010967 +27 317811 3 0.000010014 +28 514229 3 0.000010014