_xowiki__api_randomized (private)

 _xowiki__api_randomized

Defined in packages/xowiki/tcl/test/api-test-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_true aa_true (public) tcl::mathfunc::max tcl::mathfunc::max _xowiki__api_randomized _xowiki__api_randomized _xowiki__api_randomized->aa_equals _xowiki__api_randomized->aa_log _xowiki__api_randomized->aa_log_result _xowiki__api_randomized->aa_true _xowiki__api_randomized->tcl::mathfunc::max

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        #
        # Single random value, seeded or not.
        #
        aa_true "randomized index upper" {[::xowiki::randomized_index 10] < 10}
        aa_true "randomized index lower" {[::xowiki::randomized_index 10] >= 0}
        aa_equals "randomized index seeded: [::xowiki::randomized_index -seed 123 10]"  [::xowiki::randomized_index -seed 123 10] 1
        aa_equals "randomized index seeded: [::xowiki::randomized_index -seed 456 10]"  [::xowiki::randomized_index -seed 456 10] 8

        #
        # Randomized indices, seeded or not.
        #
        aa_equals "randomized indices [::xowiki::randomized_indices -seed 789 5]"  [::xowiki::randomized_indices -seed 789 5] {3 0 4 1 2}
        aa_equals "randomized indices min "  [::tcl::mathfunc::min {*}[::xowiki::randomized_indices 5]] 0
        aa_equals "randomized indices min "  [::tcl::mathfunc::max {*}[::xowiki::randomized_indices 5]] 4
    }} {
          aa_log "Running testcase body $body_count"
          set ::__aa_test_indent [info level]
          set catch_val [catch $testcase_body msg]
          if {$catch_val != 0 && $catch_val != 2} {
              aa_log_result "fail" "api_randomized (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: