int
main (int argc, char *argv[])
{
- GNUNET_log_setup ("test-regex", "WARNING", NULL);
-
int error;
+ char *r;
+ GNUNET_log_setup ("test-regex", "WARNING", NULL);
error = 0;
+ /* this is just a performance test ... */
+ r = GNUNET_TUN_ipv4policy2regex ("1.2.3.4/16:!25;");
+ GNUNET_break (NULL != r);
+ GNUNET_free (r);
+
error +=
test_iptoregex ("192.1.2.3", 2086,
"4-0826-C0010203",
"4-(0050|0051)-C001....");
error +=
test_policy4toregex ("192.1.0.0/8:!3-65535;",
- "4-(0001|0002)-C0......");
+ "4-000(0|1|2)-C0......");
+ error +=
+ test_policy4toregex ("192.1.0.0/8:!25-56;",
+ "4-(0(0(0.|1(0|1|2|3|4|5|6|7|8)|3(9|A|B|C|D|E|F)|(4|5|6|7|8|9|A|B|C|D|E|F).)|(1|2|3|4|5|6|7|8|9|A|B|C|D|E|F)..)|(1|2|3|4|5|6|7|8|9|A|B|C|D|E|F)...)-C0......");
error +=
test_policy6toregex ("E1E1::1;",
"6-....-E1E10000000000000000000000000001");