caldav::test::ical_stats (private)

 caldav::test::ical_stats [ -require_crlf ] ical_text

Defined in packages/caldav/tcl/test/caldav-test-procs.tcl

Check the ical text for validity and return a dict with descriptive statistics.

Switches:
-require_crlf (optional, boolean, defaults to "true")
Parameters:
ical_text (required)

Partial Call Graph (max 5 caller/called nodes):
%3 caldav::test::get_lowest_uid caldav::test::get_lowest_uid (private) caldav::test::ical_stats caldav::test::ical_stats caldav::test::get_lowest_uid->caldav::test::ical_stats caldav::test::ical_valid caldav::test::ical_valid (private) caldav::test::ical_valid->caldav::test::ical_stats

Testcases:
No testcase defined.
Source code:
        #set F [open [ad_tmpdir]/dump.ics w]; puts -nonewline $F $resp; close $F

    array set count {
        lines 0 lines_without_crlf 0 overlong_lines 0 continuation_lines 0
        nr_uids 0 uids {}
    }
    foreach line [split $ical_text \n] {
        incr count(lines)
        if {$require_crlf_p && [string index $line end] ne "\r"} {
        incr count(lines_without_crlf)
        #ns_log notice "line_without_crlf: $line"
        }
        if {[string index $line 0] eq " "} {
        incr count(continuation_lines)
        }

        if {[string length $line] > 76} {
        incr count(overlong_lines)
        ns_log warning "overlong_line (chars [string length $line]): <$line>"
        }
        if {[regexp {^UID:(.*)\r$} $line . uid]} {
        incr count(nr_uids)
        lappend count(uids) $uid
        }
    }
    return [array get count]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: