From: Ben Pfaff Date: Wed, 4 Mar 2009 20:32:19 +0000 (-0800) Subject: classifier: Add tests for classifier_count(), classifier_count_exact(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5fd2f5c51ffe6359df4fafc21116313cc73d2d7;p=openvswitch classifier: Add tests for classifier_count(), classifier_count_exact(). --- diff --git a/tests/test-classifier.c b/tests/test-classifier.c index 20fd7c23..869cfd98 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -90,6 +90,19 @@ tcls_destroy(struct tcls *tcls) } } +static int +tcls_count_exact(const struct tcls *tcls) +{ + int n_exact; + size_t i; + + n_exact = 0; + for (i = 0; i < tcls->n_rules; i++) { + n_exact += tcls->rules[i]->cls_rule.wc.wildcards == 0; + } + return n_exact; +} + static bool tcls_is_empty(const struct tcls *tcls) { @@ -318,6 +331,8 @@ compare_classifiers(struct classifier *cls, struct tcls *tcls) { unsigned int i; + assert(classifier_count(cls) == tcls->n_rules); + assert(classifier_count_exact(cls) == tcls_count_exact(tcls)); for (i = 0; i < N_FLOW_VALUES; i++) { struct cls_rule *cr0, *cr1; flow_t flow;