MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / test_check_tmrec_expr

Function test_check_tmrec_expr

modules/cfgutils/test/cfgutils.c:582–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580
581
582void test_check_tmrec_expr(void)
583{
584 #define _1 UTC"|20200605T115135|20200605T115136"
585 #define _0 UTC"|20200605T115135|20200605T115135"
586 #define _ctr(_tr) cmtr(_tr, now)
587
588 /* OR operator: basic test */
589 ok(_ctr(_0 "/") == -2);
590 ok(_ctr(_1 "/") == -2);
591 ok(_ctr(_1 "/" _1 "/") == -2);
592 ok(_ctr(_1 "/ foobar") == -2);
593
594 ok(_ctr(_0 "/" _0) == -1);
595 ok(_ctr(_1 "/" _0) == 1);
596 ok(_ctr(_0 "/" _1) == 1);
597 ok(_ctr(_1 "/" _1) == 1);
598 ok(_ctr(_0 " / " _0) == -1);
599 ok(_ctr(_1 " / " _0) == 1);
600 ok(_ctr(_0 " / " _1) == 1);
601 ok(_ctr(_1 " / " _1) == 1);
602
603 /* OR operator: multiple operands */
604 ok(_ctr(_0 "/" _0 "/" _0 "/" _0) == -1);
605 ok(_ctr(_0 "/" _0 "/" _0 "/" _1) == 1);
606 ok(_ctr(_0 "/" _1 "/" _0 "/" _0) == 1);
607 ok(_ctr(_1 "/" _0 "/" _0 "/" _0) == 1);
608
609
610 /* AND operator: basic test */
611 ok(_ctr(_0 "&") == -2);
612 ok(_ctr(_1 "&") == -2);
613 ok(_ctr(_0 "&" _0 "&") == -2);
614 ok(_ctr(_0 "& foobar") == -2);
615
616 ok(_ctr(_0 "&" _0) == -1);
617 ok(_ctr(_1 "&" _0) == -1);
618 ok(_ctr(_0 "&" _1) == -1);
619 ok(_ctr(_1 "&" _1) == 1);
620 ok(_ctr(_0 " &" _0) == -1);
621 ok(_ctr(_1 " &" _0) == -1);
622 ok(_ctr(_0 " &" _1) == -1);
623 ok(_ctr(_1 " &" _1) == 1);
624
625 /* AND operator: multiple operands */
626 ok(_ctr(_0 "&" _0 "&" _0 "&" _0) == -1);
627 ok(_ctr(_0 "&" _0 "&" _0 "&" _1) == -1);
628 ok(_ctr(_1 "&" _0 "&" _0 "&" _0) == -1);
629 ok(_ctr(_1 "&" _1 "&" _0 "&" _1) == -1);
630 ok(_ctr(_1 "&" _1 "&" _1 "&" _1) == 1);
631
632
633 /* simple parenthesization */
634 ok(_ctr("("_0")") == -1);
635 ok(_ctr("("_1")") == 1);
636 ok(_ctr("("_1 "/" _1 "&" _1")") == -2);
637 ok(_ctr("("_1 "&" _1 "/" _1")") == -2);
638 ok(_ctr("("_1 " / " _1 " & " _1")") == -2);
639 ok(_ctr("("_1 " & " _1 " / " _1")") == -2);

Callers 1

mod_testsFunction · 0.85

Calls 1

cmtrFunction · 0.85

Tested by

no test coverage detected