_acs-tcl__ad_pad (private)

 _acs-tcl__ad_pad

Defined in packages/acs-tcl/tcl/test/text-html-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_log aa_log (public) aa_log_result aa_log_result (public) aa_section aa_section (public) aa_true aa_true (public) ad_generate_random_string ad_generate_random_string (public) _acs-tcl__ad_pad _acs-tcl__ad_pad _acs-tcl__ad_pad->aa_log _acs-tcl__ad_pad->aa_log_result _acs-tcl__ad_pad->aa_section _acs-tcl__ad_pad->aa_true _acs-tcl__ad_pad->ad_generate_random_string

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{

    aa_section "Testing left pad"

    set string [ad_generate_random_string]
    set length [expr {1 + int(rand()*1000)}]
    set padstring [ad_generate_random_string]

    aa_log " - string: $string"
    aa_log " - length: $length"
    aa_log " - padstring: $padstring"

    set result [ad_pad -left $string $length $padstring]

    aa_true " - Result is exactly $length long " {[string length $result] == $length}
    incr length -1
    set string [string range $string end-$length end]
    aa_true " - String is at right end " [regexp "^.*${string}\$" $result]

    aa_section "Testing right pad"

    set string [ad_generate_random_string]
    set length [expr {1 + int(rand()*1000)}]
    set padstring [ad_generate_random_string]

    aa_log " - string: $string"
    aa_log " - length: $length"
    aa_log " - padstring: $padstring"

    set result [ad_pad -right $string $length $padstring]

    aa_true " - Result is exactly $length long " {[string length $result] == $length}
    incr length -1
    set string [string range $string 0 $length-1]
    aa_true " - String is at left end " [regexp "^${string}.*\$" $result]

}} {
          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" "ad_pad (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: