omdl  v0.9.5
OpenSCAD Mechanical Design Library
validation.scad
Go to the documentation of this file.
1 //! Methods for validating the results of functions.
2 /***************************************************************************//**
3  \file
4  \author Roy Allen Sutton
5  \date 2015-2024
6 
7  \copyright
8 
9  This file is part of [omdl] (https://github.com/royasutton/omdl),
10  an OpenSCAD mechanical design library.
11 
12  The \em omdl is free software; you can redistribute it and/or modify
13  it under the terms of the [GNU Lesser General Public License]
14  (http://www.gnu.org/licenses/lgpl.html) as published by the Free
15  Software Foundation; either version 2.1 of the License, or (at
16  your option) any later version.
17 
18  The \em omdl is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  Lesser General Public License for more details.
22 
23  You should have received a copy of the GNU Lesser General Public
24  License along with the \em omdl; if not, write to the Free Software
25  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26  02110-1301, USA; or see <http://www.gnu.org/licenses/>.
27 
28  \details
29 
30  \amu_define group_name (Validation Functions)
31  \amu_define group_brief (Run-time test and validation functions.)
32 
33  \amu_include (include/amu/pgid_path_pstem_pg.amu)
34 *******************************************************************************/
35 
36 //----------------------------------------------------------------------------//
37 // group.
38 //----------------------------------------------------------------------------//
39 
40 /***************************************************************************//**
41  \amu_include (include/amu/group_in_parent_start.amu)
42  \amu_include (include/amu/includes_required.amu)
43 *******************************************************************************/
44 
45 //----------------------------------------------------------------------------//
46 // common
47 //----------------------------------------------------------------------------//
48 
49 //! Value signature assignment for log-value results table to skip a test.
51 
52 //! Compare a computed test value with an known good result.
53 /***************************************************************************//**
54  \param d <string> A description.
55  \param cv <value> A computed value to validate.
56  \param t <string | boolean> The validation type.
57  \param ev <value> The expected good value.
58 
59  \param p <number> A numerical precision for approximate comparisons.
60 
61  \param pf <boolean> Report result as pass or fail boolean value.
62 
63  \returns <string | boolean> Validation result indicating if the test
64  passed or failed.
65 
66  \details
67 
68  validation types | pass if (else fail)
69  :----------------------------:|:----------------------------:
70  "ae" \| "almost" | \p cv almost equals \p ev
71  "eq" \| "equals" | \p cv equals \p ev
72  "ne" \| "not" | \p cv not equal to \p ev
73  "t" \| "true" \| \b true | \p cv is \b true
74  "f" \| "false" \| \b false | \p cv is \b false
75 
76  \note When performing an \b "almost" equal validation, the
77  comparison precision is controlled by \p p. This specifies
78  the number of digits of precision for each numerical
79  comparison. A passing result indicates that \p cv equals
80  \p ev to the number of decimal digits specified by \p p. The
81  comparison is performed by the function almost_eq().
82 
83  \amu_define title (Validate function)
84  \amu_define scope_id (example_validate)
85  \amu_include (include/amu/scope.amu)
86 *******************************************************************************/
87 function validate
88 (
89  d,
90  cv,
91  t,
92  ev,
93  p = 4,
94  pf = false
95 ) = ( (t == "eq") || (t == "equals") ) ?
96  (
97  (cv == ev)
98  ? (pf?true : str("PASSED: '", d, "'"))
99  : (pf?false : str
100  (
101  "FAILED: '", d, "'; got '", cv,
102  "', expected to equal '", ev, "'."
103  )
104  )
105  )
106  : ( (t == "ne") || (t == "not") ) ?
107  (
108  (cv != ev)
109  ? (pf?true : str("PASSED: '", d, "'"))
110  : (pf?false : str
111  (
112  "FAILED: '", d, "'; got '", cv,
113  "', expected to not equal '", ev, "'."
114  )
115  )
116  )
117  : ( (t == true) || (t == "true") || (t == "t") ) ? validate(d, cv, "equals", true, p, pf)
118  : ( (t == false) || (t == "false") || (t == "f") ) ? validate(d, cv, "equals", false, p, pf)
119  : ( (t == "ae") || (t == "almost") ) ?
120  (
121  almost_eq(cv, ev, p)
122  ? (pf?true : str("PASSED: '", d, "'"))
123  : (pf?false : str
124  (
125  "FAILED: '", d, "'; got '", cv,
126  "', expected to almost equal '", ev, "'.",
127  " to ", p, " digits"
128  )
129  )
130  )
131  : (pf?false : str("FAILED: '", d, "'; unknown test '", t, "'."));
132 
133 //! Output text \p t to the test log.
134 /***************************************************************************//**
135  \param t <string> A message to output to log.
136 *******************************************************************************/
137 module validate_log( t ) { log_type ( "omdl_test", t ); }
138 
139 //! Output that function named \p fn has been skipped to the test log.
140 /***************************************************************************//**
141  \param fn <string> The name of the skipped function.
142 *******************************************************************************/
143 module validate_skip( fn ) { validate_log ( str("ignore: '", fn, "'") ); }
144 
145 //----------------------------------------------------------------------------//
146 // validation tables
147 //----------------------------------------------------------------------------//
148 
149 //! Create data structure for related table validation functions.
150 /***************************************************************************//**
151  \param tr <table> The test data table rows.
152  \param gr <table> The expected result data table rows.
153 
154  \returns <datastruct> A structure used with the related table
155  validation functions.
156 *******************************************************************************/
157 function table_validate_init
158 (
159  tr,
160  gr
161 ) = let
162  (
163  ids = table_get_row_ids( tr )
164  )
165  [
166  tr, // db[0] test row
167  [["id","identifier"],["td","description"],["vl","value-list"]], // db[1] test data columns
168  gr, // db[2] good result row
169  merge_p([concat("id",ids),concat("identifier",ids)]) // db[3] good result columns
170  ];
171 
172 //! Encode an entry for test table.
173 /***************************************************************************//**
174  \param id <string> The test identifier.
175  \param td <string> The test description.
176  \param v1 <value> The test argument value 1.
177  \param v2 <value> The test argument value 1.
178  \param v3 <value> The test argument value 1.
179 
180  \returns <datastruct> An test table entry.
181 *******************************************************************************/
182 function table_validate_fmt
183 (
184  id,
185  td,
186  v1,
187  v2,
188  v3
189 ) = !is_undef(v2) && !is_undef(v3) ? [id, td, [v1, v2, v3]]
190  : !is_undef(v2) ? [id, td, [v1, v2]]
191  : [id, td, [v1]];
192 
193 //! Return a list of test identifiers in \p db.
194 /***************************************************************************//**
195  \param db <datastruct> An initialized validation table data structure.
196 
197  \returns <list> A list of test identifiers.
198 *******************************************************************************/
199 function table_validate_get_ids( db ) = table_get_row_ids( db[0] );
200 
201 //! Return the expected value.
202 /***************************************************************************//**
203  \param db <datastruct> An initialized validation table data structure.
204  \param fn <string> The function name.
205  \param id <string> The test identifier.
206 
207  \returns <value> The expect value.
208 *******************************************************************************/
209 function table_validate_get_ev( db, fn, id ) = table_get_value(db[2], db[3], fn, id);
210 
211 //! Return the test description.
212 /***************************************************************************//**
213  \param db <datastruct> An initialized validation table data structure.
214  \param id <string> The test identifier.
215 
216  \returns <value> The test description.
217 *******************************************************************************/
218 function table_validate_get_td( db, id ) = table_get_value(db[0], db[1], id, "td");
219 
220 //! Return the test argument value 1.
221 /***************************************************************************//**
222  \param db <datastruct> An initialized validation table data structure.
223  \param id <string> The test identifier.
224 
225  \returns <value> The test argument value 1.
226 *******************************************************************************/
227 function table_validate_get_v1( db, id ) = first(table_get_value(db[0], db[1], id, "vl"));
228 
229 //! Return the test argument value 2.
230 /***************************************************************************//**
231  \param db <datastruct> An initialized validation table data structure.
232  \param id <string> The test identifier.
233 
234  \returns <value> The test argument value 2.
235 *******************************************************************************/
236 function table_validate_get_v2( db, id ) = second(table_get_value(db[0], db[1], id, "vl"));
237 
238 //! Return the test argument value 3.
239 /***************************************************************************//**
240  \param db <datastruct> An initialized validation table data structure.
241  \param id <string> The test identifier.
242 
243  \returns <value> The test argument value 3.
244 *******************************************************************************/
245 function table_validate_get_v3( db, id ) = third(table_get_value(db[0], db[1], id, "vl"));
246 
247 //! Test data structure \p db and output the start of test to the test log.
248 /***************************************************************************//**
249  \param db <datastruct> An initialized validation table data structure.
250  \param verbose <boolean> Be more verbose.
251 *******************************************************************************/
252 module table_validate_start( db, verbose=false )
253 {
254  if ( verbose )
255  validate_log( "checking data structure" );
256 
257  // check test table
258  table_check( db[0], db[1], verbose );
259 
260  // check expected result table
261  table_check( db[2], db[3], verbose );
262 
263  validate_log( str("openscad version ", version()) );
264 }
265 
266 //! Validate and log a test function return value against its expected value.
267 /***************************************************************************//**
268  \param db <datastruct> An initialized validation table data structure.
269  \param id <string> The test identifier.
270  \param fn <string> The function name.
271  \param argc <integer> The number of arguments to retrieve from \p db.
272  \param fr <value> The value returned from the tested function.
273  \param t <string | boolean> The validation type.
274  \param p <number> A numerical precision for approximate comparisons.
275 
276  \details
277 
278  See function validate() for more information on possible values for
279  parameters \p t and \p p.
280 
281  \amu_define title (Table-based validation)
282  \amu_define scope_id (example_table)
283  \amu_include (include/amu/scope.amu)
284 *******************************************************************************/
285 module table_validate
286 (
287  db,
288  id,
289  fn,
290  argc,
291  fr,
292  t="equals",
293  p=6
294 )
295 {
296  td = table_validate_get_td(db, id);
297  ev = table_validate_get_ev(db, fn, id);
298 
299  if ( ev != validation_skip )
300  {
301  vd = (argc == 3) ? str(fn, "(", table_validate_get_v1(db, id),
302  ",", table_validate_get_v2(db, id),
303  ",", table_validate_get_v3(db, id), ")=", ev)
304  : (argc == 2) ? str(fn, "(", table_validate_get_v1(db, id),
305  ",", table_validate_get_v2(db, id), ")=", ev)
306  : (argc == 1) ? str(fn, "(", table_validate_get_v1(db, id), ")=", ev)
307  : str(fn, "(*)=", ev);
308 
309  lm = validate( d=vd, cv=fr, t=t, p=p, ev=ev );
310 
311  if ( !validate( cv=fr, t=t, p=p, ev=ev, pf=true ) )
312  validate_log( str(id, " ", lm, " ---> \"", td, "\"") );
313  else
314  validate_log( str(id, " ", lm) );
315  }
316  else
317  validate_log( str(id, " -skip-: '", fn, "(", td, ")'") );
318 }
319 
320 //----------------------------------------------------------------------------//
321 // validation maps
322 //----------------------------------------------------------------------------//
323 
324 //! Create data structure for related map validation functions.
325 /***************************************************************************//**
326  \param m <map> The test data map.
327  \param fn <string> The function name.
328 
329  \returns <datastruct> A structure used with the related map
330  validation functions.
331 *******************************************************************************/
332 function map_validate_init
333 (
334  m,
335  fn
336 ) =
337  [
338  m, // db[0] test map
339  fn // db[1] function name
340  ];
341 
342 //! Encode an entry for test map.
343 /***************************************************************************//**
344  \param id <string> The test identifier.
345  \param td <string> The test description.
346  \param ev <value> The test expect value.
347  \param v1 <value> The test argument value 1.
348  \param v2 <value> The test argument value 1.
349  \param v3 <value> The test argument value 1.
350 
351  \returns <datastruct> An test map entry.
352 *******************************************************************************/
353 function map_validate_fmt
354 (
355  id,
356  td,
357  ev,
358  v1,
359  v2,
360  v3
361 ) = !is_undef(v2) && !is_undef(v3) ? [id, [td, ev, [v1, v2, v3]]]
362  : !is_undef(v2) ? [id, [td, ev, [v1, v2]]]
363  : [id, [td, ev, [v1]]];
364 
365 //! Return a list of test identifiers in \p db.
366 /***************************************************************************//**
367  \param db <datastruct> An initialized validation map data structure.
368 
369  \returns <list> A list of test identifiers.
370 *******************************************************************************/
371 function map_validate_get_ids( db ) = map_get_keys(db[0]);
372 
373 
374 //! Return the test function name.
375 /***************************************************************************//**
376  \param db <datastruct> An initialized validation map data structure.
377 
378  \returns <string> The test function name.
379 *******************************************************************************/
380 function map_validate_get_fn( db ) = db[1];
381 
382 //! Return the test description.
383 /***************************************************************************//**
384  \param db <datastruct> An initialized validation map data structure.
385  \param id <string> The test identifier.
386 
387  \returns <string> The test description for a given test \p id.
388 *******************************************************************************/
389 function map_validate_get_td( db, id ) = map_get_value(db[0], id)[0];
390 
391 //! Return the expected value.
392 /***************************************************************************//**
393  \param db <datastruct> An initialized validation map data structure.
394  \param id <string> The test identifier.
395 
396  \returns <value> The expect value.
397 *******************************************************************************/
398 function map_validate_get_ev( db, id ) = map_get_value(db[0], id)[1];
399 
400 //! Return the test argument value 1.
401 /***************************************************************************//**
402  \param db <datastruct> An initialized validation map data structure.
403  \param id <string> The test identifier.
404 
405  \returns <value> The argument value 1.
406 *******************************************************************************/
407 function map_validate_get_v1( db, id ) = first(map_get_value(db[0], id)[2]);
408 
409 //! Return the test argument value 2.
410 /***************************************************************************//**
411  \param db <datastruct> An initialized validation map data structure.
412  \param id <string> The test identifier.
413 
414  \returns <value> The argument value 2.
415 *******************************************************************************/
416 function map_validate_get_v2( db, id ) = second(map_get_value(db[0], id)[2]);
417 
418 //! Return the test argument value 3.
419 /***************************************************************************//**
420  \param db <datastruct> An initialized validation map data structure.
421  \param id <string> The test identifier.
422 
423  \returns <value> The argument value 3.
424 *******************************************************************************/
425 function map_validate_get_v3( db, id ) = third(map_get_value(db[0], id)[2]);
426 
427 //! Test data structure \p db and output the start of test to the test log.
428 /***************************************************************************//**
429  \param db <datastruct> An initialized validation map data structure.
430  \param verbose <boolean> Be more verbose.
431 *******************************************************************************/
432 module map_validate_start( db, verbose=false )
433 {
434  if ( verbose )
435  validate_log( "checking data structure" );
436 
437  // check map
438  map_check( db[0], verbose );
439 
440  validate_log( str("openscad version ", version()) );
441  validate_log( str(map_validate_get_fn(db), "()") );
442 }
443 
444 //! Validate and log a test function return value against its expected value.
445 /***************************************************************************//**
446  \param db <datastruct> An initialized validation map data structure.
447  \param id <string> The test identifier.
448  \param argc <integer> The number of arguments to retrieve from \p db.
449  \param fr <value> The value returned from the tested function.
450  \param t <string | boolean> The validation type.
451  \param p <number> A numerical precision for approximate comparisons.
452 
453  \details
454 
455  See function validate() for more information on possible values for
456  parameters \p t and \p p.
457 
458  \amu_define title (Map-based validation)
459  \amu_define scope_id (example_map)
460  \amu_include (include/amu/scope.amu)
461 *******************************************************************************/
462 module map_validate
463 (
464  db,
465  id,
466  argc,
467  fr,
468  t="equals",
469  p=6
470 )
471 {
472  fn = map_validate_get_fn(db);
473 
474  td = map_validate_get_td(db, id);
475  ev = map_validate_get_ev(db, id);
476 
477  if ( ev != validation_skip )
478  {
479  vd = (argc == 3) ? str(fn, "(", map_validate_get_v1(db, id),
480  ",", map_validate_get_v2(db, id),
481  ",", map_validate_get_v3(db, id), ")=", ev)
482  : (argc == 2) ? str(fn, "(", map_validate_get_v1(db, id),
483  ",", map_validate_get_v2(db, id), ")=", ev)
484  : (argc == 1) ? str(fn, "(", map_validate_get_v1(db, id), ")=", ev)
485  : str(fn, "(*)=", ev);
486 
487  lm = validate( d=vd, cv=fr, t=t, p=p, ev=ev );
488 
489  if ( !validate( cv=fr, t=t, p=p, ev=ev, pf=true ) )
490  validate_log( str(id, " ", lm, " ---> \"", td, "\"") );
491  else
492  validate_log( str(id, " ", lm) );
493  }
494  else
495  validate_log( str(id, " -skip-: '", fn, "(", td, ")'") );
496 }
497 
498 //! @}
499 //! @}
500 
501 //----------------------------------------------------------------------------//
502 // openscad-amu auxiliary scripts
503 //----------------------------------------------------------------------------//
504 
505 /*
506 BEGIN_SCOPE example_validate;
507  BEGIN_OPENSCAD;
508  include <omdl-base.scad>;
509  include <common/validation.scad>;
510 
511  //
512  // function to validate
513  //
514  function f1( x ) = (x == undef) ? 1 : 2;
515 
516  farg = undef; // function test argument
517  erv1 = 1; // correct expected function result
518  erv2 = 3; // incorrect expected function result
519 
520  //
521  // pass test example
522  //
523  log_type( "EXAMPLE 1", "pass test example" );
524 
525  pass_result = validate("test-a f1(farg)", f1(farg), "equals", erv1);
526 
527  if ( !validate(cv=f1(farg), t="equals", ev=erv1, pf=true) )
528  log_warn( pass_result );
529  else
530  log_info( pass_result );
531 
532  //
533  // fail test example
534  //
535  log_type( "EXAMPLE 2", "fail test example" );
536 
537  fail_result = validate("test-b f1(farg)", f1(farg), "equals", erv2);
538 
539  if ( !validate(cv=f1(farg), t="equals", ev=erv2, pf=true) )
540  log_warn( fail_result );
541  else
542  log_info( fail_result );
543 
544  //
545  // almost equal test example
546  //
547  log_type( "EXAMPLE 3", "almost equal test example" );
548 
549  tvae1 = [[90.001], [[45.009], true]];
550  tvae2 = [[90.002], [[45.010], true]];
551 
552  log_type( "EXAMPLE 3", "almost equal to 3 digits" );
553  log_info( validate("test-c", tvae1, "almost", tvae2, 3) );
554 
555  log_type( "EXAMPLE 3", "almost equal to 4 digits" );
556  log_info( validate("test-d", tvae1, "almost", tvae2, 4) );
557 
558  // end_include
559  END_OPENSCAD;
560 
561  BEGIN_MFSCRIPT;
562  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
563  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
564  END_MFSCRIPT;
565 END_SCOPE;
566 
567 BEGIN_SCOPE example_table;
568  BEGIN_OPENSCAD;
569  include <omdl-base.scad>;
570  include <common/validation.scad>;
571 
572  function fmt( id, td, v1, v2, v3 ) = table_validate_fmt(id, td, v1, v2, v3);
573  function v1(db, id) = table_validate_get_v1(db, id);
574  t = true; f = false; u = undef; s = validation_skip;
575 
576  // table: test values
577  tbl_test_values =
578  [
579  fmt("t01", "The undefined value", undef),
580  fmt("t02", "A small decimal (epsilon)", eps),
581  fmt("t03", "The max number", number_max),
582  fmt("t04", "The invalid number nan", 0 / 0),
583  fmt("t05", "The boolean true", true),
584  fmt("t06", "A string", "This is a longer string"),
585  fmt("t07", "The empty string", empty_str),
586  fmt("t08", "The empty list", empty_lst),
587  fmt("t09", "A list of lists", [[1,2,3], [4,5,6], [7,8,9]]),
588  fmt("t10", "A range", [0:0.5:9])
589  ];
590 
591  // table: expected results: use 's' to skip
592  tbl_test_answers =
593  [ // function 01 02 03 04 05 06 07 08 09 101
594  ["is_bool", f, f, f, f, f, f, f, f, f, t],
595  ["is_string", f, f, f, f, f, f, f, f, f, f],
596  ["is_list", f, f, f, f, f, f, f, f, f, f]
597  ];
598 
599  db = table_validate_init( tbl_test_values, tbl_test_answers );
600 
601  table_validate_start( db );
602  test_ids = table_validate_get_ids( db );
603 
604  for (id=test_ids) table_validate( db, id, "is_bool", 1, is_bool( v1(db, id) ) );
605  for (id=test_ids) table_validate( db, id, "is_string", 1, is_string( v1(db, id) ) );
606  for (id=test_ids) table_validate( db, id, "is_list", 1, is_list( v1(db, id) ) );
607 
608  // end_include
609  END_OPENSCAD;
610 
611  BEGIN_MFSCRIPT;
612  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
613  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
614  END_MFSCRIPT;
615 END_SCOPE;
616 
617 BEGIN_SCOPE example_map;
618  BEGIN_OPENSCAD;
619  include <omdl-base.scad>;
620  include <common/validation.scad>;
621 
622  function fmt( id, td, ev, v1, v2, v3 ) = map_validate_fmt(id, td, ev, v1, v2, v3);
623  function v1( db, id ) = map_validate_get_v1(db, id);
624  function v2( db, id ) = map_validate_get_v2(db, id);
625 
626  map_test_defined_or =
627  [
628  fmt("t01", "Undefined", 1, undef, 1),
629  fmt("t02", "A small value", eps, eps, 2),
630  fmt("t03", "Infinity", number_inf, number_inf, 3),
631  fmt("t04", "Max number", number_max, number_max, 4),
632  fmt("t05", "Undefined list", [undef], [undef], 5),
633  fmt("t06", "Short range", [0:9], [0:9], 6),
634  fmt("t07", "Empty string", empty_str, empty_str, 7),
635  fmt("t08", "Empty list", empty_lst, empty_lst, 8)
636  ];
637 
638  db = map_validate_init( map_test_defined_or, "defined_or" );
639  map_validate_start( db );
640 
641  for ( id = map_validate_get_ids( db ) )
642  map_validate( db, id, 2, defined_or ( v1(db, id), v2(db, id) ) );
643 
644  // end_include
645  END_OPENSCAD;
646 
647  BEGIN_MFSCRIPT;
648  include --path "${INCLUDE_PATH}" {var_init,var_gen_term}.mfs;
649  include --path "${INCLUDE_PATH}" scr_make_mf.mfs;
650  END_MFSCRIPT;
651 END_SCOPE;
652 */
653 
654 //----------------------------------------------------------------------------//
655 // end of file
656 //----------------------------------------------------------------------------//
module log_type(t, m)
Output diagnostic message to console.
Definition: console.scad:284
number_inf
The OpenSCAD inf value (infinity).
Definition: constants.scad:295
number_max
<decimal> The largest representable number in OpenSCAD scripts.
Definition: constants.scad:289
number_min
<decimal> The smallest representable number in OpenSCAD scripts.
Definition: constants.scad:292
function map_validate_init(m, fn)
Create data structure for related map validation functions.
function map_validate_get_fn(db)
Return the test function name.
function validate(d, cv, t, ev, p=4, pf=false)
Compare a computed test value with an known good result.
module table_validate_start(db, verbose=false)
Test data structure db and output the start of test to the test log.
function map_validate_fmt(id, td, ev, v1, v2, v3)
Encode an entry for test map.
module validate_skip(fn)
Output that function named fn has been skipped to the test log.
module map_validate_start(db, verbose=false)
Test data structure db and output the start of test to the test log.
function table_validate_get_v3(db, id)
Return the test argument value 3.
validation_skip
Value signature assignment for log-value results table to skip a test.
function map_validate_get_v2(db, id)
Return the test argument value 2.
function table_validate_get_ids(db)
Return a list of test identifiers in db.
module validate_log(t)
Output text t to the test log.
function table_validate_init(tr, gr)
Create data structure for related table validation functions.
function table_validate_get_v2(db, id)
Return the test argument value 2.
function table_validate_get_ev(db, fn, id)
Return the expected value.
function map_validate_get_td(db, id)
Return the test description.
function map_validate_get_ev(db, id)
Return the expected value.
module table_validate(db, id, fn, argc, fr, t="equals", p=6)
Validate and log a test function return value against its expected value.
module map_validate(db, id, argc, fr, t="equals", p=6)
Validate and log a test function return value against its expected value.
function map_validate_get_v3(db, id)
Return the test argument value 3.
function table_validate_fmt(id, td, v1, v2, v3)
Encode an entry for test table.
function map_validate_get_ids(db)
Return a list of test identifiers in db.
function map_validate_get_v1(db, id)
Return the test argument value 1.
function table_validate_get_v1(db, id)
Return the test argument value 1.
function table_validate_get_td(db, id)
Return the test description.
function third(v)
Return the third element of an iterable value.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
function almost_eq(v1, v2, p=6)
Test if all elements of two iterable values are sufficiently equal.
function merge_p(v, j=true)
Parallel-merge the iterable elements of a list.
function map_get_value(m, k)
Get the map value associated with a key.
function map_get_keys(m)
Get a list of all map keys.
module map_check(m, verbose=false)
Perform basic format checks on a map and output errors to console.
Definition: map.scad:431
module table_check(r, c, verbose=false)
Perform basic format checks on a table and output errors to console.
Definition: table.scad:595
function table_get_row_ids(r)
Form a list of all table row identifiers.
function table_get_value(r, c, ri, ci)
Get the table cell value for a specified row and column identifier.