geoip2_c 0.3.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +23 -0
  3. data/.github/workflows/ubuntu.yml +17 -8
  4. data/.github/workflows/windows.yml +18 -8
  5. data/.gitmodules +0 -3
  6. data/ext/geoip2/extconf.rb +9 -25
  7. data/ext/geoip2/geoip2.c +82 -32
  8. data/geoip2_c.gemspec +1 -0
  9. data/lib/geoip2/version.rb +1 -1
  10. metadata +18 -182
  11. data/ext/geoip2/libmaxminddb/.gitignore +0 -38
  12. data/ext/geoip2/libmaxminddb/.gitmodules +0 -9
  13. data/ext/geoip2/libmaxminddb/.perltidyrc +0 -11
  14. data/ext/geoip2/libmaxminddb/.travis.yml +0 -70
  15. data/ext/geoip2/libmaxminddb/.uncrustify.cfg +0 -78
  16. data/ext/geoip2/libmaxminddb/AUTHORS +0 -0
  17. data/ext/geoip2/libmaxminddb/Changes.md +0 -277
  18. data/ext/geoip2/libmaxminddb/LICENSE +0 -202
  19. data/ext/geoip2/libmaxminddb/Makefile.am +0 -41
  20. data/ext/geoip2/libmaxminddb/NOTICE +0 -13
  21. data/ext/geoip2/libmaxminddb/README.dev.md +0 -69
  22. data/ext/geoip2/libmaxminddb/README.md +0 -122
  23. data/ext/geoip2/libmaxminddb/appveyor.yml +0 -33
  24. data/ext/geoip2/libmaxminddb/bin/Makefile.am +0 -10
  25. data/ext/geoip2/libmaxminddb/bin/mmdblookup.c +0 -715
  26. data/ext/geoip2/libmaxminddb/bootstrap +0 -21
  27. data/ext/geoip2/libmaxminddb/common.mk +0 -7
  28. data/ext/geoip2/libmaxminddb/configure.ac +0 -132
  29. data/ext/geoip2/libmaxminddb/dev-bin/make-man-pages.pl +0 -76
  30. data/ext/geoip2/libmaxminddb/dev-bin/ppa-release.sh +0 -53
  31. data/ext/geoip2/libmaxminddb/dev-bin/regen-prototypes.pl +0 -136
  32. data/ext/geoip2/libmaxminddb/dev-bin/regen-win32-test-projs.pl +0 -54
  33. data/ext/geoip2/libmaxminddb/dev-bin/release.sh +0 -113
  34. data/ext/geoip2/libmaxminddb/dev-bin/uncrustify-all.sh +0 -21
  35. data/ext/geoip2/libmaxminddb/dev-bin/valgrind-all.pl +0 -53
  36. data/ext/geoip2/libmaxminddb/doc/libmaxminddb.md +0 -889
  37. data/ext/geoip2/libmaxminddb/doc/mmdblookup.md +0 -103
  38. data/ext/geoip2/libmaxminddb/include/maxminddb.h +0 -241
  39. data/ext/geoip2/libmaxminddb/include/maxminddb_config.h.in +0 -14
  40. data/ext/geoip2/libmaxminddb/projects/VS12/README.md +0 -59
  41. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-release.props +0 -32
  42. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb-x64.props +0 -14
  43. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.props +0 -32
  44. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.sln +0 -150
  45. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj +0 -143
  46. data/ext/geoip2/libmaxminddb/projects/VS12/libmaxminddb.vcxproj.filters +0 -32
  47. data/ext/geoip2/libmaxminddb/projects/VS12/maxminddb_config.h +0 -14
  48. data/ext/geoip2/libmaxminddb/projects/VS12-tests/bad_pointers.vcxproj +0 -105
  49. data/ext/geoip2/libmaxminddb/projects/VS12-tests/basic_lookup.vcxproj +0 -105
  50. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_entry_list.vcxproj +0 -105
  51. data/ext/geoip2/libmaxminddb/projects/VS12-tests/data_types.vcxproj +0 -105
  52. data/ext/geoip2/libmaxminddb/projects/VS12-tests/dump.vcxproj +0 -105
  53. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value.vcxproj +0 -105
  54. data/ext/geoip2/libmaxminddb/projects/VS12-tests/get_value_pointer_bug.vcxproj +0 -105
  55. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv4_start_cache.vcxproj +0 -105
  56. data/ext/geoip2/libmaxminddb/projects/VS12-tests/ipv6_lookup_in_ipv4.vcxproj +0 -105
  57. data/ext/geoip2/libmaxminddb/projects/VS12-tests/libtap.vcxproj +0 -85
  58. data/ext/geoip2/libmaxminddb/projects/VS12-tests/maxminddb_test_helper.vcxproj +0 -107
  59. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata.vcxproj +0 -105
  60. data/ext/geoip2/libmaxminddb/projects/VS12-tests/metadata_pointers.vcxproj +0 -105
  61. data/ext/geoip2/libmaxminddb/projects/VS12-tests/no_map_get_value.vcxproj +0 -105
  62. data/ext/geoip2/libmaxminddb/projects/VS12-tests/read_node.vcxproj +0 -105
  63. data/ext/geoip2/libmaxminddb/projects/VS12-tests/shared.vcxproj +0 -104
  64. data/ext/geoip2/libmaxminddb/projects/VS12-tests/threads.vcxproj +0 -103
  65. data/ext/geoip2/libmaxminddb/projects/VS12-tests/version.vcxproj +0 -105
  66. data/ext/geoip2/libmaxminddb/projects/test.vcxproj.template +0 -105
  67. data/ext/geoip2/libmaxminddb/src/Makefile.am +0 -25
  68. data/ext/geoip2/libmaxminddb/src/data-pool.c +0 -180
  69. data/ext/geoip2/libmaxminddb/src/data-pool.h +0 -52
  70. data/ext/geoip2/libmaxminddb/src/libmaxminddb.pc.in +0 -11
  71. data/ext/geoip2/libmaxminddb/src/maxminddb-compat-util.h +0 -167
  72. data/ext/geoip2/libmaxminddb/src/maxminddb.c +0 -2181
  73. data/ext/geoip2/libmaxminddb/t/Makefile.am +0 -27
  74. data/ext/geoip2/libmaxminddb/t/bad_databases_t.c +0 -67
  75. data/ext/geoip2/libmaxminddb/t/bad_pointers_t.c +0 -53
  76. data/ext/geoip2/libmaxminddb/t/basic_lookup_t.c +0 -207
  77. data/ext/geoip2/libmaxminddb/t/compile_c++_t.pl +0 -107
  78. data/ext/geoip2/libmaxminddb/t/data-pool-t.c +0 -374
  79. data/ext/geoip2/libmaxminddb/t/data_entry_list_t.c +0 -353
  80. data/ext/geoip2/libmaxminddb/t/data_types_t.c +0 -439
  81. data/ext/geoip2/libmaxminddb/t/dump_t.c +0 -103
  82. data/ext/geoip2/libmaxminddb/t/external_symbols_t.pl +0 -106
  83. data/ext/geoip2/libmaxminddb/t/get_value_pointer_bug_t.c +0 -66
  84. data/ext/geoip2/libmaxminddb/t/get_value_t.c +0 -249
  85. data/ext/geoip2/libmaxminddb/t/ipv4_start_cache_t.c +0 -36
  86. data/ext/geoip2/libmaxminddb/t/ipv6_lookup_in_ipv4_t.c +0 -48
  87. data/ext/geoip2/libmaxminddb/t/libtap/.gitignore +0 -13
  88. data/ext/geoip2/libmaxminddb/t/libtap/.travis.yml +0 -13
  89. data/ext/geoip2/libmaxminddb/t/libtap/COPYING +0 -165
  90. data/ext/geoip2/libmaxminddb/t/libtap/INSTALL +0 -41
  91. data/ext/geoip2/libmaxminddb/t/libtap/Makefile +0 -72
  92. data/ext/geoip2/libmaxminddb/t/libtap/Makefile.win +0 -37
  93. data/ext/geoip2/libmaxminddb/t/libtap/README.md +0 -268
  94. data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.c +0 -20
  95. data/ext/geoip2/libmaxminddb/t/libtap/t/cmp_mem.expected +0 -28
  96. data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.c +0 -16
  97. data/ext/geoip2/libmaxminddb/t/libtap/t/cmpok.expected +0 -37
  98. data/ext/geoip2/libmaxminddb/t/libtap/t/diag.c +0 -10
  99. data/ext/geoip2/libmaxminddb/t/libtap/t/diag.expected +0 -2
  100. data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.c +0 -14
  101. data/ext/geoip2/libmaxminddb/t/libtap/t/diesok.expected +0 -6
  102. data/ext/geoip2/libmaxminddb/t/libtap/t/is.c +0 -24
  103. data/ext/geoip2/libmaxminddb/t/libtap/t/is.expected +0 -58
  104. data/ext/geoip2/libmaxminddb/t/libtap/t/like.c +0 -10
  105. data/ext/geoip2/libmaxminddb/t/libtap/t/like.expected +0 -4
  106. data/ext/geoip2/libmaxminddb/t/libtap/t/simple.c +0 -31
  107. data/ext/geoip2/libmaxminddb/t/libtap/t/simple.expected +0 -32
  108. data/ext/geoip2/libmaxminddb/t/libtap/t/skip.c +0 -23
  109. data/ext/geoip2/libmaxminddb/t/libtap/t/skip.expected +0 -9
  110. data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.c +0 -13
  111. data/ext/geoip2/libmaxminddb/t/libtap/t/synopsis.expected +0 -9
  112. data/ext/geoip2/libmaxminddb/t/libtap/t/test.c +0 -28
  113. data/ext/geoip2/libmaxminddb/t/libtap/t/todo.c +0 -17
  114. data/ext/geoip2/libmaxminddb/t/libtap/t/todo.expected +0 -11
  115. data/ext/geoip2/libmaxminddb/t/libtap/tap.c +0 -354
  116. data/ext/geoip2/libmaxminddb/t/libtap/tap.h +0 -115
  117. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitattributes +0 -1
  118. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitconfig +0 -2
  119. data/ext/geoip2/libmaxminddb/t/maxmind-db/.gitignore +0 -2
  120. data/ext/geoip2/libmaxminddb/t/maxmind-db/.perltidyallrc +0 -11
  121. data/ext/geoip2/libmaxminddb/t/maxmind-db/.tidyallrc +0 -7
  122. data/ext/geoip2/libmaxminddb/t/maxmind-db/LICENSE +0 -4
  123. data/ext/geoip2/libmaxminddb/t/maxmind-db/MaxMind-DB-spec.md +0 -558
  124. data/ext/geoip2/libmaxminddb/t/maxmind-db/README.md +0 -4
  125. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/README.md +0 -7
  126. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  127. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  128. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +0 -1
  129. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  130. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  131. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/invalid-string-length.mmdb +0 -1
  132. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +0 -1
  133. data/ext/geoip2/libmaxminddb/t/maxmind-db/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  134. data/ext/geoip2/libmaxminddb/t/maxmind-db/perltidyrc +0 -12
  135. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Anonymous-IP-Test.json +0 -32
  136. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-City-Test.json +0 -12616
  137. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Connection-Type-Test.json +0 -102
  138. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Country-Test.json +0 -10975
  139. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-DensityIncome-Test.json +0 -14
  140. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Domain-Test.json +0 -452
  141. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Enterprise-Test.json +0 -666
  142. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-ISP-Test.json +0 -12585
  143. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoIP2-Precision-Enterprise-Test.json +0 -1035
  144. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/GeoLite2-ASN-Test.json +0 -37
  145. data/ext/geoip2/libmaxminddb/t/maxmind-db/source-data/README +0 -13
  146. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  147. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  148. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  149. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-City-Test.mmdb +0 -0
  150. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  151. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Country-Test.mmdb +0 -0
  152. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  153. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  154. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  155. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  156. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  157. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  158. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  159. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  160. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  161. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  162. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  163. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  164. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  165. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  166. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  167. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  168. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  169. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  170. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  171. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  172. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  173. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  174. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/README.md +0 -26
  175. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/maps-with-pointers.raw +0 -0
  176. data/ext/geoip2/libmaxminddb/t/maxmind-db/test-data/write-test-data.pl +0 -614
  177. data/ext/geoip2/libmaxminddb/t/maxmind-db/tidyall.ini +0 -5
  178. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.c +0 -255
  179. data/ext/geoip2/libmaxminddb/t/maxminddb_test_helper.h +0 -69
  180. data/ext/geoip2/libmaxminddb/t/metadata_pointers_t.c +0 -32
  181. data/ext/geoip2/libmaxminddb/t/metadata_t.c +0 -226
  182. data/ext/geoip2/libmaxminddb/t/mmdblookup_t.pl +0 -158
  183. data/ext/geoip2/libmaxminddb/t/no_map_get_value_t.c +0 -32
  184. data/ext/geoip2/libmaxminddb/t/read_node_t.c +0 -157
  185. data/ext/geoip2/libmaxminddb/t/threads_t.c +0 -196
  186. data/ext/geoip2/libmaxminddb/t/version_t.c +0 -10
@@ -1,23 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(8);
5
- skip(0, 3, "%s cannot fork", "windows");
6
- ok(1, "quux");
7
- ok(1, "thud");
8
- ok(1, "wombat");
9
- end_skip;
10
- skip(1, 1, "need to be on windows");
11
- ok(0, "blurgle");
12
- end_skip;
13
- skip(0, 3);
14
- ok(1, "quux");
15
- ok(1, "thud");
16
- ok(1, "wombat");
17
- end_skip;
18
- skip(1, 1);
19
- ok(0, "blurgle");
20
- end_skip;
21
- done_testing();
22
- }
23
-
@@ -1,9 +0,0 @@
1
- 1..8
2
- ok 1 - quux
3
- ok 2 - thud
4
- ok 3 - wombat
5
- ok 4 # skip need to be on windows
6
- ok 5 - quux
7
- ok 6 - thud
8
- ok 7 - wombat
9
- ok 8 # skip
@@ -1,13 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(5);
5
- int bronze = 1, silver = 2, gold = 3;
6
- ok(bronze < silver, "bronze is less than silver");
7
- ok(bronze > silver, "not quite");
8
- is("gold", "gold", "gold is gold");
9
- cmp_ok(silver, "<", gold, "%d <= %d", silver, gold);
10
- like("platinum", ".*inum", "platinum matches .*inum");
11
- done_testing();
12
- }
13
-
@@ -1,9 +0,0 @@
1
- 1..5
2
- ok 1 - bronze is less than silver
3
- not ok 2 - not quite
4
- # Failed test 'not quite'
5
- # at t/synopsis.c line 7.
6
- ok 3 - gold is gold
7
- ok 4 - 2 <= 3
8
- ok 5 - platinum matches .*inum
9
- # Looks like you failed 1 test of 5 run.
@@ -1,28 +0,0 @@
1
- #include "tap.h"
2
- #include <stdio.h>
3
- #include <dirent.h>
4
- #include <stdlib.h>
5
- #include <string.h>
6
-
7
- int main () {
8
- DIR *dp = opendir("t");
9
- if (!dp) {
10
- perror("opendir");
11
- exit(1);
12
- }
13
- struct dirent *ep;
14
- while ((ep = readdir(dp))) {
15
- char *name = ep->d_name;
16
- if (strchr(name, '.') || !strcmp(name, "test"))
17
- continue;
18
- char command[1024];
19
- snprintf(command, 1024, "./t/%s >t/%s.got 2>&1", name, name);
20
- system(command);
21
- snprintf(command, 1024, "diff -up t/%s.expected t/%s.got", name, name);
22
- int retval = system(command);
23
- ok(!(retval >> 8), name);
24
- }
25
- closedir(dp);
26
- done_testing();
27
- }
28
-
@@ -1,17 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(6);
5
- todo();
6
- ok(0, "foo");
7
- ok(1, "bar");
8
- ok(1, "baz");
9
- end_todo;
10
- todo("im not ready");
11
- ok(0, "quux");
12
- ok(1, "thud");
13
- ok(1, "wombat");
14
- end_todo;
15
- done_testing();
16
- }
17
-
@@ -1,11 +0,0 @@
1
- 1..6
2
- not ok 1 - foo # TODO
3
- # Failed (TODO) test 'foo'
4
- # at t/todo.c line 6.
5
- ok 2 - bar # TODO
6
- ok 3 - baz # TODO
7
- not ok 4 - quux # TODO im not ready
8
- # Failed (TODO) test 'quux'
9
- # at t/todo.c line 11.
10
- ok 5 - thud # TODO im not ready
11
- ok 6 - wombat # TODO im not ready
@@ -1,354 +0,0 @@
1
- /*
2
- libtap - Write tests in C
3
- Copyright 2012 Jake Gelbman <gelbman@gmail.com>
4
- This file is licensed under the LGPL
5
- */
6
-
7
- #define _DEFAULT_SOURCE 1
8
-
9
- #include <stdio.h>
10
- #include <stdlib.h>
11
- #include <stdarg.h>
12
- #include <string.h>
13
- #include "tap.h"
14
-
15
- static int expected_tests = NO_PLAN;
16
- static int failed_tests;
17
- static int current_test;
18
- static char *todo_mesg;
19
-
20
- static char *
21
- vstrdupf (const char *fmt, va_list args) {
22
- char *str;
23
- int size;
24
- va_list args2;
25
- va_copy(args2, args);
26
- if (!fmt)
27
- fmt = "";
28
- size = vsnprintf(NULL, 0, fmt, args2) + 2;
29
- str = malloc(size);
30
- if (!str) {
31
- perror("malloc error");
32
- exit(1);
33
- }
34
- vsprintf(str, fmt, args);
35
- va_end(args2);
36
- return str;
37
- }
38
-
39
- void
40
- tap_plan (int tests, const char *fmt, ...) {
41
- expected_tests = tests;
42
- if (tests == SKIP_ALL) {
43
- char *why;
44
- va_list args;
45
- va_start(args, fmt);
46
- why = vstrdupf(fmt, args);
47
- va_end(args);
48
- printf("1..0 ");
49
- diag("SKIP %s\n", why);
50
- exit(0);
51
- }
52
- if (tests != NO_PLAN) {
53
- printf("1..%d\n", tests);
54
- }
55
- }
56
-
57
- int
58
- vok_at_loc (const char *file, int line, int test, const char *fmt,
59
- va_list args)
60
- {
61
- char *name = vstrdupf(fmt, args);
62
- if (!test) {
63
- printf("not ");
64
- }
65
- printf("ok %d", ++current_test);
66
- if (*name)
67
- printf(" - %s", name);
68
- if (todo_mesg) {
69
- printf(" # TODO");
70
- if (*todo_mesg)
71
- printf(" %s", todo_mesg);
72
- }
73
- printf("\n");
74
- if (!test) {
75
- printf("# Failed ");
76
- if (todo_mesg)
77
- printf("(TODO) ");
78
- printf("test ");
79
- if (*name)
80
- printf("'%s'\n# ", name);
81
- printf("at %s line %d.\n", file, line);
82
- if (!todo_mesg)
83
- failed_tests++;
84
- }
85
- free(name);
86
- return test;
87
- }
88
-
89
- int
90
- ok_at_loc (const char *file, int line, int test, const char *fmt, ...) {
91
- va_list args;
92
- va_start(args, fmt);
93
- vok_at_loc(file, line, test, fmt, args);
94
- va_end(args);
95
- return test;
96
- }
97
-
98
- static int
99
- mystrcmp (const char *a, const char *b) {
100
- return a == b ? 0 : !a ? -1 : !b ? 1 : strcmp(a, b);
101
- }
102
-
103
- #define eq(a, b) (!mystrcmp(a, b))
104
- #define ne(a, b) (mystrcmp(a, b))
105
-
106
- int
107
- is_at_loc (const char *file, int line, const char *got, const char *expected,
108
- const char *fmt, ...)
109
- {
110
- int test = eq(got, expected);
111
- va_list args;
112
- va_start(args, fmt);
113
- vok_at_loc(file, line, test, fmt, args);
114
- va_end(args);
115
- if (!test) {
116
- diag(" got: '%s'", got);
117
- diag(" expected: '%s'", expected);
118
- }
119
- return test;
120
- }
121
-
122
- int
123
- isnt_at_loc (const char *file, int line, const char *got, const char *expected,
124
- const char *fmt, ...)
125
- {
126
- int test = ne(got, expected);
127
- va_list args;
128
- va_start(args, fmt);
129
- vok_at_loc(file, line, test, fmt, args);
130
- va_end(args);
131
- if (!test) {
132
- diag(" got: '%s'", got);
133
- diag(" expected: anything else");
134
- }
135
- return test;
136
- }
137
-
138
- int
139
- cmp_ok_at_loc (const char *file, int line, int a, const char *op, int b,
140
- const char *fmt, ...)
141
- {
142
- int test = eq(op, "||") ? a || b
143
- : eq(op, "&&") ? a && b
144
- : eq(op, "|") ? a | b
145
- : eq(op, "^") ? a ^ b
146
- : eq(op, "&") ? a & b
147
- : eq(op, "==") ? a == b
148
- : eq(op, "!=") ? a != b
149
- : eq(op, "<") ? a < b
150
- : eq(op, ">") ? a > b
151
- : eq(op, "<=") ? a <= b
152
- : eq(op, ">=") ? a >= b
153
- : eq(op, "<<") ? a << b
154
- : eq(op, ">>") ? a >> b
155
- : eq(op, "+") ? a + b
156
- : eq(op, "-") ? a - b
157
- : eq(op, "*") ? a * b
158
- : eq(op, "/") ? a / b
159
- : eq(op, "%") ? a % b
160
- : diag("unrecognized operator '%s'", op);
161
- va_list args;
162
- va_start(args, fmt);
163
- vok_at_loc(file, line, test, fmt, args);
164
- va_end(args);
165
- if (!test) {
166
- diag(" %d", a);
167
- diag(" %s", op);
168
- diag(" %d", b);
169
- }
170
- return test;
171
- }
172
-
173
- static int
174
- find_mem_diff (const char *a, const char *b, size_t n, size_t *offset) {
175
- size_t i;
176
- if (a == b)
177
- return 0;
178
- if (!a || !b)
179
- return 2;
180
- for (i = 0; i < n; i++) {
181
- if (a[i] != b[i]) {
182
- *offset = i;
183
- return 1;
184
- }
185
- }
186
- return 0;
187
- }
188
-
189
- int
190
- cmp_mem_at_loc (const char *file, int line, const void *got,
191
- const void *expected, size_t n, const char *fmt, ...)
192
- {
193
- size_t offset;
194
- int diff = find_mem_diff(got, expected, n, &offset);
195
- va_list args;
196
- va_start(args, fmt);
197
- vok_at_loc(file, line, !diff, fmt, args);
198
- va_end(args);
199
- if (diff == 1) {
200
- diag(" Difference starts at offset %d", offset);
201
- diag(" got: 0x%02x", ((unsigned char *)got)[offset]);
202
- diag(" expected: 0x%02x", ((unsigned char *)expected)[offset]);
203
- }
204
- else if (diff == 2) {
205
- diag(" got: %s", got ? "not NULL" : "NULL");
206
- diag(" expected: %s", expected ? "not NULL" : "NULL");
207
- }
208
- return !diff;
209
- }
210
-
211
- int
212
- diag (const char *fmt, ...) {
213
- va_list args;
214
- char *mesg, *line;
215
- int i;
216
- va_start(args, fmt);
217
- if (!fmt)
218
- return 0;
219
- mesg = vstrdupf(fmt, args);
220
- line = mesg;
221
- for (i = 0; *line; i++) {
222
- char c = mesg[i];
223
- if (!c || c == '\n') {
224
- mesg[i] = '\0';
225
- printf("# %s\n", line);
226
- if (!c)
227
- break;
228
- mesg[i] = c;
229
- line = mesg + i + 1;
230
- }
231
- }
232
- free(mesg);
233
- va_end(args);
234
- return 0;
235
- }
236
-
237
- int
238
- exit_status () {
239
- int retval = 0;
240
- if (expected_tests == NO_PLAN) {
241
- printf("1..%d\n", current_test);
242
- }
243
- else if (current_test != expected_tests) {
244
- diag("Looks like you planned %d test%s but ran %d.",
245
- expected_tests, expected_tests > 1 ? "s" : "", current_test);
246
- retval = 2;
247
- }
248
- if (failed_tests) {
249
- diag("Looks like you failed %d test%s of %d run.",
250
- failed_tests, failed_tests > 1 ? "s" : "", current_test);
251
- retval = 1;
252
- }
253
- return retval;
254
- }
255
-
256
- int
257
- bail_out (int ignore, const char *fmt, ...) {
258
- va_list args;
259
- va_start(args, fmt);
260
- printf("Bail out! ");
261
- vprintf(fmt, args);
262
- printf("\n");
263
- va_end(args);
264
- exit(255);
265
- return 0;
266
- }
267
-
268
- void
269
- tap_skip (int n, const char *fmt, ...) {
270
- char *why;
271
- va_list args;
272
- va_start(args, fmt);
273
- why = vstrdupf(fmt, args);
274
- va_end(args);
275
- while (n --> 0) {
276
- printf("ok %d ", ++current_test);
277
- diag("skip %s\n", why);
278
- }
279
- free(why);
280
- }
281
-
282
- void
283
- tap_todo (int ignore, const char *fmt, ...) {
284
- va_list args;
285
- va_start(args, fmt);
286
- todo_mesg = vstrdupf(fmt, args);
287
- va_end(args);
288
- }
289
-
290
- void
291
- tap_end_todo () {
292
- free(todo_mesg);
293
- todo_mesg = NULL;
294
- }
295
-
296
- #ifndef _WIN32
297
- #include <sys/mman.h>
298
- #include <sys/param.h>
299
- #include <regex.h>
300
-
301
- #if defined __APPLE__ || defined BSD
302
- #define MAP_ANONYMOUS MAP_ANON
303
- #endif
304
-
305
- /* Create a shared memory int to keep track of whether a piece of code executed
306
- dies. to be used in the dies_ok and lives_ok macros. */
307
- int
308
- tap_test_died (int status) {
309
- static int *test_died = NULL;
310
- int prev;
311
- if (!test_died) {
312
- test_died = mmap(0, sizeof (int), PROT_READ | PROT_WRITE,
313
- MAP_SHARED | MAP_ANONYMOUS, -1, 0);
314
- *test_died = 0;
315
- }
316
- prev = *test_died;
317
- *test_died = status;
318
- return prev;
319
- }
320
-
321
- int
322
- like_at_loc (int for_match, const char *file, int line, const char *got,
323
- const char *expected, const char *fmt, ...)
324
- {
325
- int test;
326
- regex_t re;
327
- va_list args;
328
- int err = regcomp(&re, expected, REG_EXTENDED);
329
- if (err) {
330
- char errbuf[256];
331
- regerror(err, &re, errbuf, sizeof errbuf);
332
- fprintf(stderr, "Unable to compile regex '%s': %s at %s line %d\n",
333
- expected, errbuf, file, line);
334
- exit(255);
335
- }
336
- err = regexec(&re, got, 0, NULL, 0);
337
- regfree(&re);
338
- test = for_match ? !err : err;
339
- va_start(args, fmt);
340
- vok_at_loc(file, line, test, fmt, args);
341
- va_end(args);
342
- if (!test) {
343
- if (for_match) {
344
- diag(" '%s'", got);
345
- diag(" doesn't match: '%s'", expected);
346
- }
347
- else {
348
- diag(" '%s'", got);
349
- diag(" matches: '%s'", expected);
350
- }
351
- }
352
- return test;
353
- }
354
- #endif
@@ -1,115 +0,0 @@
1
- /*
2
- libtap - Write tests in C
3
- Copyright 2012 Jake Gelbman <gelbman@gmail.com>
4
- This file is licensed under the LGPL
5
- */
6
-
7
- #ifndef __TAP_H__
8
- #define __TAP_H__
9
-
10
- #ifdef __cplusplus
11
- extern "C" {
12
- #endif
13
-
14
- #ifndef va_copy
15
- #ifdef __va_copy
16
- #define va_copy __va_copy
17
- #else
18
- #define va_copy(d, s) ((d) = (s))
19
- #endif
20
- #endif
21
-
22
- #include <stdio.h>
23
- #include <stdlib.h>
24
- #include <stdarg.h>
25
-
26
- int vok_at_loc (const char *file, int line, int test, const char *fmt,
27
- va_list args);
28
- int ok_at_loc (const char *file, int line, int test, const char *fmt,
29
- ...);
30
- int is_at_loc (const char *file, int line, const char *got,
31
- const char *expected, const char *fmt, ...);
32
- int isnt_at_loc (const char *file, int line, const char *got,
33
- const char *expected, const char *fmt, ...);
34
- int cmp_ok_at_loc (const char *file, int line, int a, const char *op,
35
- int b, const char *fmt, ...);
36
- int cmp_mem_at_loc (const char *file, int line, const void *got,
37
- const void *expected, size_t n, const char *fmt, ...);
38
- int bail_out (int ignore, const char *fmt, ...);
39
- void tap_plan (int tests, const char *fmt, ...);
40
- int diag (const char *fmt, ...);
41
- int exit_status (void);
42
- void tap_skip (int n, const char *fmt, ...);
43
- void tap_todo (int ignore, const char *fmt, ...);
44
- void tap_end_todo (void);
45
-
46
- #define NO_PLAN -1
47
- #define SKIP_ALL -2
48
- #define ok(...) ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
49
- #define is(...) is_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
50
- #define isnt(...) isnt_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
51
- #define cmp_ok(...) cmp_ok_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
52
- #define cmp_mem(...) cmp_mem_at_loc(__FILE__, __LINE__, __VA_ARGS__, NULL)
53
- #define plan(...) tap_plan(__VA_ARGS__, NULL)
54
- #define done_testing() return exit_status()
55
- #define BAIL_OUT(...) bail_out(0, "" __VA_ARGS__, NULL)
56
- #define pass(...) ok(1, "" __VA_ARGS__)
57
- #define fail(...) ok(0, "" __VA_ARGS__)
58
-
59
- #define skip(test, ...) do {if (test) {tap_skip(__VA_ARGS__, NULL); break;}
60
- #define end_skip } while (0)
61
-
62
- #define todo(...) tap_todo(0, "" __VA_ARGS__, NULL)
63
- #define end_todo tap_end_todo()
64
-
65
- #define dies_ok(...) dies_ok_common(1, __VA_ARGS__)
66
- #define lives_ok(...) dies_ok_common(0, __VA_ARGS__)
67
-
68
- #ifdef _WIN32
69
- #define like(...) tap_skip(1, "like is not implemented on Windows")
70
- #define unlike tap_skip(1, "unlike is not implemented on Windows")
71
- #define dies_ok_common(...) \
72
- tap_skip(1, "Death detection is not supported on Windows")
73
- #else
74
- #define like(...) like_at_loc(1, __FILE__, __LINE__, __VA_ARGS__, NULL)
75
- #define unlike(...) like_at_loc(0, __FILE__, __LINE__, __VA_ARGS__, NULL)
76
- int like_at_loc (int for_match, const char *file, int line,
77
- const char *got, const char *expected,
78
- const char *fmt, ...);
79
- #include <unistd.h>
80
- #include <sys/types.h>
81
- #include <sys/wait.h>
82
- int tap_test_died (int status);
83
- #define dies_ok_common(for_death, code, ...) \
84
- do { \
85
- int cpid; \
86
- int it_died; \
87
- tap_test_died(1); \
88
- cpid = fork(); \
89
- switch (cpid) { \
90
- case -1: \
91
- perror("fork error"); \
92
- exit(1); \
93
- case 0: \
94
- close(1); \
95
- close(2); \
96
- code \
97
- tap_test_died(0); \
98
- exit(0); \
99
- } \
100
- if (waitpid(cpid, NULL, 0) < 0) { \
101
- perror("waitpid error"); \
102
- exit(1); \
103
- } \
104
- it_died = tap_test_died(0); \
105
- if (!it_died) \
106
- {code} \
107
- ok(for_death ? it_died : !it_died, "" __VA_ARGS__); \
108
- } while (0)
109
- #endif
110
-
111
- #ifdef __cplusplus
112
- }
113
- #endif
114
-
115
- #endif
@@ -1 +0,0 @@
1
- *.mmdb diff=mmdb
@@ -1,2 +0,0 @@
1
- [diff "mmdb"]
2
- textconv = hexdump -v -C
@@ -1,2 +0,0 @@
1
- /_site
2
- .tidyall.d
@@ -1,11 +0,0 @@
1
- --blank-lines-before-packages=0
2
- --iterations=2
3
- --no-outdent-long-comments
4
- -bar
5
- -boc
6
- -ci=4
7
- -i=4
8
- -l=78
9
- -nolq
10
- -se
11
- -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
@@ -1,7 +0,0 @@
1
- [PerlTidy]
2
- select = **/*.{pl,pm,t,psgi}
3
- ignore = blib/**/*
4
- argv = --profile=$ROOT/.perltidyallrc
5
-
6
- [JSON]
7
- select = **/*.json
@@ -1,4 +0,0 @@
1
- This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
2
- Unported License. To view a copy of this license, visit
3
- http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
4
- Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.