Просмотр исходного кода

add more tests as suggested by Natanael Copa and as harvested from:
http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/92880

Mike Frysinger 16 лет назад
Родитель
Сommit
b9a82d5b22
1 измененных файлов с 31 добавлено и 1 удалено
  1. 31 1
      test/inet/tst-network.c

+ 31 - 1
test/inet/tst-network.c

@@ -43,7 +43,37 @@ struct
   {"1.1410.", INADDR_NONE},
   {"1.1410", INADDR_NONE},
   {"141.76.1111", INADDR_NONE},
-  {"141.76.1111.", INADDR_NONE}
+  {"141.76.1111.", INADDR_NONE},
+  /* Now some from BSD */
+  {"0x12", 0x00000012},
+  {"127.1", 0x00007f01},
+  {"127.1.2.3", 0x7f010203},
+  {"0x123456", INADDR_NONE},
+  {"0x12.0x34", 0x00001234},
+  {"0x12.0x345", INADDR_NONE},
+  {"1.2.3.4.5", INADDR_NONE},
+  {"1..3.4", INADDR_NONE},
+  {".", INADDR_NONE},
+  {"1.", INADDR_NONE},
+  {".1", INADDR_NONE},
+  {"x", INADDR_NONE},
+  {"0x", INADDR_NONE},
+  {"0", 0x00000000},
+  {"0x0", 0x00000000},
+  {"01.02.07.077", 0x0102073f},
+  {"0x1.23.045.0", 0x01172500},
+  {"", INADDR_NONE},
+  {" ", INADDR_NONE},
+  {"bar", INADDR_NONE},
+  {"1.2bar", INADDR_NONE},
+  {"1.", INADDR_NONE},
+  {"ÊÃÕËÅÎ", INADDR_NONE},
+  {"255.255.255.255", INADDR_NONE},
+  {"x", INADDR_NONE},
+  {"0X12", 0x00000012},
+  {"078", INADDR_NONE},
+  {"1 bar", INADDR_NONE},
+  {"127.0xfff", INADDR_NONE},
 };