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,72 +0,0 @@
1
- CC ?= gcc
2
- CFLAGS += -Wall -I. -fPIC
3
- PREFIX ?= $(DESTDIR)/usr/local
4
- TESTS = $(patsubst %.c, %, $(wildcard t/*.c))
5
-
6
- ifdef ANSI
7
- # -D_BSD_SOURCE for MAP_ANONYMOUS
8
- CFLAGS += -ansi -D_BSD_SOURCE
9
- LDLIBS += -lbsd-compat
10
- endif
11
-
12
- %:
13
- $(CC) $(LDFLAGS) $(TARGET_ARCH) $(filter %.o %.a %.so, $^) $(LDLIBS) -o $@
14
-
15
- %.o:
16
- $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $(filter %.c, $^) $(LDLIBS) -o $@
17
-
18
- %.a:
19
- $(AR) rcs $@ $(filter %.o, $^)
20
-
21
- %.so:
22
- $(CC) -shared $(LDFLAGS) $(TARGET_ARCH) $(filter %.o, $^) $(LDLIBS) -o $@
23
-
24
- all: libtap.a libtap.so tap.pc tests
25
-
26
- tap.pc:
27
- @echo generating tap.pc
28
- @echo 'prefix='$(PREFIX) > tap.pc
29
- @echo 'exec_prefix=$${prefix}' >> tap.pc
30
- @echo 'libdir=$${prefix}/lib' >> tap.pc
31
- @echo 'includedir=$${prefix}/include' >> tap.pc
32
- @echo '' >> tap.pc
33
- @echo 'Name: libtap' >> tap.pc
34
- @echo 'Description: Write tests in C' >> tap.pc
35
- @echo 'Version: 0.1.0' >> tap.pc
36
- @echo 'URL: https://github.com/zorgnax/libtap' >> tap.pc
37
- @echo 'Libs: -L$${libdir} -ltap' >> tap.pc
38
- @echo 'Cflags: -I$${includedir}' >> tap.pc
39
-
40
- libtap.a: tap.o
41
-
42
- libtap.so: tap.o
43
-
44
- tap.o: tap.c tap.h
45
-
46
- tests: $(TESTS)
47
-
48
- $(TESTS): %: %.o libtap.a
49
-
50
- $(patsubst %, %.o, $(TESTS)): %.o: %.c tap.h
51
-
52
- clean:
53
- rm -rf *.o t/*.o tap.pc libtap.a libtap.so $(TESTS)
54
-
55
- install: libtap.a tap.h libtap.so tap.pc
56
- mkdir -p $(PREFIX)/lib $(PREFIX)/include $(PREFIX)/lib/pkgconfig
57
- install -c libtap.a $(PREFIX)/lib
58
- install -c libtap.so $(PREFIX)/lib
59
- install -c tap.pc $(PREFIX)/lib/pkgconfig
60
- install -c tap.h $(PREFIX)/include
61
-
62
- uninstall:
63
- rm $(PREFIX)/lib/libtap.a $(PREFIX)/lib/libtap.so $(PREFIX)/include/tap.h
64
-
65
- dist:
66
- rm libtap.zip
67
- zip -r libtap *
68
-
69
- check test: all
70
- ./t/test
71
-
72
- .PHONY: all clean install uninstall dist check test tests
@@ -1,37 +0,0 @@
1
- CFLAGS = /Zi /Wall /wd4255 /wd4996 /wd4127 /wd4820 /wd4100 /wd4619 \
2
- /wd4514 /wd4668 /I.
3
- CC = cl /nologo
4
- TESTS = $(patsubst %.c, %.exe, $(wildcard t/*.c))
5
-
6
- %.exe:
7
- $(CC) $(LDFLAGS) $(filter %.obj %.lib %.dll, $^) $(LDLIBS) /Fe $@
8
-
9
- %.o:
10
- $(CC) $(CFLAGS) $(CPPFLAGS) /c $(filter %.c, $^) $(LDLIBS) /Fo $@
11
-
12
- %.lib:
13
- lib /nologo /out:$@ $(filter %.obj, $^)
14
-
15
- %.dll:
16
- lib /nologo /out:$@ $(filter %.obj, $^)
17
-
18
- all: tap.lib tests
19
-
20
- tap.lib: tap.obj
21
-
22
- tap.obj: tap.c tap.h
23
-
24
- tests: $(TESTS)
25
-
26
- $(TESTS): %.exe: %.obj tap.lib
27
-
28
- $(patsubst %.exe, %.obj, $(TESTS)): %.obj: %.c tap.h
29
-
30
- clean:
31
- rm -rf *.obj t/*.obj tap.lib $(TESTS)
32
-
33
- check test: all
34
- prove
35
-
36
- .PHONY: all clean check test tests
37
-
@@ -1,268 +0,0 @@
1
- NAME
2
- ====
3
-
4
- libtap - Write tests in C
5
-
6
- SYNOPSIS
7
- ========
8
-
9
- #include <tap.h>
10
-
11
- int main () {
12
- plan(5);
13
- int bronze = 1, silver = 2, gold = 3;
14
- ok(bronze < silver, "bronze is less than silver");
15
- ok(bronze > silver, "not quite");
16
- is("gold", "gold", "gold is gold");
17
- cmp_ok(silver, "<", gold, "%d <= %d", silver, gold);
18
- like("platinum", ".*inum", "platinum matches .*inum");
19
- done_testing();
20
- }
21
-
22
- results in:
23
-
24
- 1..5
25
- ok 1 - bronze is less than silver
26
- not ok 2 - not quite
27
- # Failed test 'not quite'
28
- # at t/synopsis.c line 7.
29
- ok 3 - gold is gold
30
- ok 4 - 2 <= 3
31
- ok 5 - platinum matches .*inum
32
- # Looks like you failed 1 test of 5 run.
33
-
34
- DESCRIPTION
35
- ===========
36
-
37
- tap is an easy to read and easy to write way of creating tests for
38
- your software. This library creates functions that can be used to
39
- generate it for your C programs. It is implemented using macros
40
- that include file and line info automatically, and makes it so that
41
- the format message of each test is optional. It is mostly based on
42
- the Test::More Perl module.
43
-
44
- INSTALL
45
- =======
46
-
47
- On **Unix** systems:
48
-
49
- $ make
50
- $ make install
51
-
52
- For more detailed installation instructions (eg, for **Windows**), see `INSTALL`.
53
-
54
- FUNCTIONS
55
- =========
56
-
57
- - plan(tests)
58
- - plan(NO_PLAN)
59
- - plan(SKIP_ALL);
60
- - plan(SKIP_ALL, fmt, ...)
61
-
62
- Use this to start a series of tests. When you know how many tests there
63
- will be, you can put a number as a number of tests you expect to run. If
64
- you do not know how many tests there will be, you can use plan(NO_PLAN)
65
- or not call this function. When you pass it a number of tests to run, a
66
- message similar to the following will appear in the output:
67
-
68
- 1..5
69
-
70
- If you pass it SKIP_ALL, the whole test will be skipped.
71
-
72
- - ok(test)
73
- - ok(test, fmt, ...)
74
-
75
- Specify a test. the test can be any statement returning a true or false
76
- value. You may optionally pass a format string describing the test.
77
-
78
- ok(r = reader_new("Of Mice and Men"), "create a new reader");
79
- ok(reader_go_to_page(r, 55), "can turn the page");
80
- ok(r->page == 55, "page turned to the right one");
81
-
82
- Should print out:
83
-
84
- ok 1 - create a new reader
85
- ok 2 - can turn the page
86
- ok 3 - page turned to the right one
87
-
88
- On failure, a diagnostic message will be printed out.
89
-
90
- not ok 3 - page turned to the right one
91
- # Failed test 'page turned to the right one'
92
- # at reader.c line 13.
93
-
94
- - is(got, expected)
95
- - is(got, expected, fmt, ...)
96
- - isnt(got, unexpected)
97
- - isnt(got, unexpected, fmt, ...)
98
-
99
- Tests that the string you got is what you expected. with isnt, it is the
100
- reverse.
101
-
102
- is("this", "that", "this is that");
103
-
104
- prints:
105
-
106
- not ok 1 - this is that
107
- # Failed test 'this is that'
108
- # at is.c line 6.
109
- # got: 'this'
110
- # expected: 'that'
111
-
112
- - cmp_ok(a, op, b)
113
- - cmp_ok(a, op, b, fmt, ...)
114
-
115
- Compares two ints with any binary operator that doesn't require an lvalue.
116
- This is nice to use since it provides a better error message than an
117
- equivalent ok.
118
-
119
- cmp_ok(420, ">", 666);
120
-
121
- prints:
122
-
123
- not ok 1
124
- # Failed test at cmpok.c line 5.
125
- # 420
126
- # >
127
- # 666
128
-
129
- - cmp_mem(got, expected, n)
130
- - cmp_mem(got, expected, n, fmt, ...)
131
-
132
- Tests that the first n bytes of the memory you got is what you expected.
133
- NULL pointers for got and expected are handled (if either is NULL,
134
- the test fails), but you need to ensure n is not too large.
135
-
136
- char *a = "foo";
137
- char *b = "bar";
138
- cmp_mem(a, b, 3)
139
-
140
- prints
141
-
142
- not ok 1
143
- # Failed test at t/cmp_mem.c line 9.
144
- # Difference starts at offset 0
145
- # got: 0x66
146
- # expected: 0x62
147
-
148
- - like(got, expected)
149
- - like(got, expected, fmt, ...)
150
- - unlike(got, unexpected)
151
- - unlike(got, unexpected, fmt, ...)
152
-
153
- Tests that the string you got matches the expected extended POSIX regex.
154
- unlike is the reverse. These macros are the equivalent of a skip on
155
- Windows.
156
-
157
- like("stranger", "^s.(r).*\\1$", "matches the regex");
158
-
159
- prints:
160
-
161
- ok 1 - matches the regex
162
-
163
- - pass()
164
- - pass(fmt, ...)
165
- - fail()
166
- - fail(fmt, ...)
167
-
168
- Speciy that a test succeeded or failed. Use these when the statement is
169
- longer than you can fit into the argument given to an ok() test.
170
-
171
- - dies_ok(code)
172
- - dies_ok(code, fmt, ...)
173
- - lives_ok(code)
174
- - lives_ok(code, fmt, ...)
175
-
176
- Tests whether the given code causes your program to exit. The code gets
177
- passed to a macro that will test it in a forked process. If the code
178
- succeeds it will be executed in the parent process. You can test things
179
- like passing a function a null pointer and make sure it doesnt
180
- dereference it and crash.
181
-
182
- dies_ok({abort();}, "abort does close your program");
183
- dies_ok({int x = 0/0;}, "divide by zero crash");
184
- lives_ok({pow(3.0, 5.0);}, "nothing wrong with taking 3**5");
185
-
186
- On Windows, these macros are the equivalent of a skip.
187
-
188
- - done_testing()
189
-
190
- Summarizes the tests that occurred and exits the main function. If
191
- there was no plan, it will print out the number of tests as.
192
-
193
- 1..5
194
-
195
- It will also print a diagnostic message about how many
196
- failures there were.
197
-
198
- # Looks like you failed 2 tests of 3 run.
199
-
200
- If all planned tests were successful, it will return 0. If any
201
- test fails, it will return 1. If they all passed, but there
202
- were missing tests, it will return 2.
203
-
204
- - diag(fmt, ...)
205
-
206
- print out a message to the tap output on stdout. Each line is
207
- preceeded by a "# " so that you know its a diagnostic message.
208
-
209
- diag("This is\na diag\nto describe\nsomething.");
210
-
211
- prints:
212
-
213
- # This is
214
- # a diag
215
- # to describe
216
- # something
217
-
218
- ok() and this function return an int so you can use it like:
219
-
220
- ok(0) || diag("doh!");
221
-
222
- - skip(test, n)
223
- - skip(test, n, fmt, ...)
224
- - end_skip
225
-
226
- Skip a series of n tests if test is true. You may give a reason why you are
227
- skipping them or not. The (possibly) skipped tests must occur between the
228
- skip and end_skip macros.
229
-
230
- skip(TRUE, 2);
231
- ok(1);
232
- ok(0);
233
- end_skip;
234
-
235
- prints:
236
-
237
- ok 1 # skip
238
- ok 2 # skip
239
-
240
- - todo()
241
- - todo(fmt, ...)
242
- - end_todo
243
-
244
- Specifies a series of tests that you expect to fail because they are not
245
- yet implemented.
246
-
247
- todo()
248
- ok(0);
249
- end_todo;
250
-
251
- prints:
252
-
253
- not ok 1 # TODO
254
- # Failed (TODO) test at todo.c line 7
255
-
256
- - BAIL_OUT()
257
- - BAIL_OUT(fmt, ...)
258
-
259
- Immediately stops all testing.
260
-
261
- BAIL_OUT("Can't go no further");
262
-
263
- prints
264
-
265
- Bail out! Can't go no further
266
-
267
- and exits with 255.
268
-
@@ -1,20 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- unsigned char all_0[] = {0, 0, 0, 0};
5
- unsigned char all_255[] = {255, 255, 255, 255};
6
- unsigned char half[] = {0, 0, 255, 255};
7
- unsigned char half_2[] = {0, 0, 255, 255};
8
-
9
- plan(8);
10
- cmp_mem(half, half_2, 4, "Same array different address");
11
- cmp_mem(all_0, all_0, 4, "Array must be equal to itself");
12
- cmp_mem(all_0, all_255, 4, "Arrays with different contents");
13
- cmp_mem(all_0, half, 4, "Arrays differ, but start the same");
14
- cmp_mem(all_0, all_255, 0, "Comparing 0 bytes of different arrays");
15
- cmp_mem(NULL, all_0, 4, "got == NULL");
16
- cmp_mem(all_0, NULL, 4, "expected == NULL");
17
- cmp_mem(NULL, NULL, 4, "got == expected == NULL");
18
- done_testing();
19
- }
20
-
@@ -1,28 +0,0 @@
1
- 1..8
2
- ok 1 - Same array different address
3
- ok 2 - Array must be equal to itself
4
- not ok 3 - Arrays with different contents
5
- # Failed test 'Arrays with different contents'
6
- # at t/cmp_mem.c line 12.
7
- # Difference starts at offset 0
8
- # got: 0x00
9
- # expected: 0xff
10
- not ok 4 - Arrays differ, but start the same
11
- # Failed test 'Arrays differ, but start the same'
12
- # at t/cmp_mem.c line 13.
13
- # Difference starts at offset 2
14
- # got: 0x00
15
- # expected: 0xff
16
- ok 5 - Comparing 0 bytes of different arrays
17
- not ok 6 - got == NULL
18
- # Failed test 'got == NULL'
19
- # at t/cmp_mem.c line 15.
20
- # got: NULL
21
- # expected: not NULL
22
- not ok 7 - expected == NULL
23
- # Failed test 'expected == NULL'
24
- # at t/cmp_mem.c line 16.
25
- # got: not NULL
26
- # expected: NULL
27
- ok 8 - got == expected == NULL
28
- # Looks like you failed 4 tests of 8 run.
@@ -1,16 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(9);
5
- cmp_ok(420, ">", 666);
6
- cmp_ok(23, "==", 55, "the number 23 is definitely 55");
7
- cmp_ok(23, "==", 55);
8
- cmp_ok(23, "!=", 55);
9
- cmp_ok(23, "frob", 55);
10
- cmp_ok(23, "<=", 55);
11
- cmp_ok(55, "+", -55);
12
- cmp_ok(23, "%", 5);
13
- cmp_ok(55, "%", 5);
14
- done_testing();
15
- }
16
-
@@ -1,37 +0,0 @@
1
- 1..9
2
- not ok 1
3
- # Failed test at t/cmpok.c line 5.
4
- # 420
5
- # >
6
- # 666
7
- not ok 2 - the number 23 is definitely 55
8
- # Failed test 'the number 23 is definitely 55'
9
- # at t/cmpok.c line 6.
10
- # 23
11
- # ==
12
- # 55
13
- not ok 3
14
- # Failed test at t/cmpok.c line 7.
15
- # 23
16
- # ==
17
- # 55
18
- ok 4
19
- # unrecognized operator 'frob'
20
- not ok 5
21
- # Failed test at t/cmpok.c line 9.
22
- # 23
23
- # frob
24
- # 55
25
- ok 6
26
- not ok 7
27
- # Failed test at t/cmpok.c line 11.
28
- # 55
29
- # +
30
- # -55
31
- ok 8
32
- not ok 9
33
- # Failed test at t/cmpok.c line 13.
34
- # 55
35
- # %
36
- # 5
37
- # Looks like you failed 6 tests of 9 run.
@@ -1,10 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- diag("diag no new line");
5
- diag("diag new line\n");
6
- diag("");
7
- diag(NULL);
8
- return 1;
9
- }
10
-
@@ -1,2 +0,0 @@
1
- # diag no new line
2
- # diag new line
@@ -1,14 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(5);
5
- ok(1, "sanity");
6
- dies_ok({int x = 0; x = x/x;}, "can't divide by zero");
7
- lives_ok({int x = 3; x = x/7;}, "this is a perfectly fine statement");
8
- dies_ok({abort();}, "abort kills the program");
9
- dies_ok(
10
- {printf("stdout\n"); fprintf(stderr, "stderr\n"); abort();},
11
- "supress output");
12
- done_testing();
13
- }
14
-
@@ -1,6 +0,0 @@
1
- 1..5
2
- ok 1 - sanity
3
- ok 2 - can't divide by zero
4
- ok 3 - this is a perfectly fine statement
5
- ok 4 - abort kills the program
6
- ok 5 - supress output
@@ -1,24 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(18);
5
- is("this", "that", "this is that"); /* bang */
6
- is("this", "this", "this is this");
7
- is("this", "that"); /* bang */
8
- is("this", "this");
9
- is(NULL, NULL, "null is null");
10
- is(NULL, "this", "null is this"); /* bang */
11
- is("this", NULL, "this is null"); /* bang */
12
- is("foo\nfoo\nfoo", "bar\nbar\nbar"); /* bang */
13
- is("foo\nfoo\nfoo", "foo\nfoo\nfoo");
14
- isnt("this", "that", "this isnt that");
15
- isnt("this", "this", "this isnt this"); /* bang */
16
- isnt("this", "that");
17
- isnt("this", "this"); /* bang */
18
- isnt(NULL, NULL, "null isnt null"); /* bang */
19
- isnt(NULL, "this", "null isnt this");
20
- isnt("this", NULL, "this isnt null");
21
- isnt("foo\nfoo\nfoo", "bar\nbar\nbar");
22
- isnt("foo\nfoo\nfoo", "foo\nfoo\nfoo"); /* bang */
23
- done_testing();
24
- }
@@ -1,58 +0,0 @@
1
- 1..18
2
- not ok 1 - this is that
3
- # Failed test 'this is that'
4
- # at t/is.c line 5.
5
- # got: 'this'
6
- # expected: 'that'
7
- ok 2 - this is this
8
- not ok 3
9
- # Failed test at t/is.c line 7.
10
- # got: 'this'
11
- # expected: 'that'
12
- ok 4
13
- ok 5 - null is null
14
- not ok 6 - null is this
15
- # Failed test 'null is this'
16
- # at t/is.c line 10.
17
- # got: '(null)'
18
- # expected: 'this'
19
- not ok 7 - this is null
20
- # Failed test 'this is null'
21
- # at t/is.c line 11.
22
- # got: 'this'
23
- # expected: '(null)'
24
- not ok 8
25
- # Failed test at t/is.c line 12.
26
- # got: 'foo
27
- # foo
28
- # foo'
29
- # expected: 'bar
30
- # bar
31
- # bar'
32
- ok 9
33
- ok 10 - this isnt that
34
- not ok 11 - this isnt this
35
- # Failed test 'this isnt this'
36
- # at t/is.c line 15.
37
- # got: 'this'
38
- # expected: anything else
39
- ok 12
40
- not ok 13
41
- # Failed test at t/is.c line 17.
42
- # got: 'this'
43
- # expected: anything else
44
- not ok 14 - null isnt null
45
- # Failed test 'null isnt null'
46
- # at t/is.c line 18.
47
- # got: '(null)'
48
- # expected: anything else
49
- ok 15 - null isnt this
50
- ok 16 - this isnt null
51
- ok 17
52
- not ok 18
53
- # Failed test at t/is.c line 22.
54
- # got: 'foo
55
- # foo
56
- # foo'
57
- # expected: anything else
58
- # Looks like you failed 9 tests of 18 run.
@@ -1,10 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(3);
5
- like("strange", "range", "strange ~~ /range/");
6
- unlike("strange", "anger", "strange !~~ /anger/");
7
- like("stranger", "^s.(r).*$", "matches the regex");
8
- done_testing();
9
- }
10
-
@@ -1,4 +0,0 @@
1
- 1..3
2
- ok 1 - strange ~~ /range/
3
- ok 2 - strange !~~ /anger/
4
- ok 3 - matches the regex
@@ -1,31 +0,0 @@
1
- #include "tap.h"
2
-
3
- int main () {
4
- plan(24);
5
- ok(1);
6
- ok(1);
7
- ok(1);
8
- ok(0);
9
- ok(1, "foo");
10
- ok(1, "bar");
11
- ok(1, "baz");
12
- ok(1, "quux");
13
- ok(1, "thud");
14
- ok(1, "wombat");
15
- ok(1, "blurgle");
16
- ok(1, "frob");
17
- ok(0, "frobnicate");
18
- ok(1, "eek");
19
- ok(1, "ook");
20
- ok(1, "frodo");
21
- ok(1, "bilbo");
22
- ok(1, "wubble");
23
- ok(1, "flarp");
24
- ok(1, "fnord");
25
- pass();
26
- fail();
27
- pass("good");
28
- fail("bad");
29
- done_testing();
30
- }
31
-
@@ -1,32 +0,0 @@
1
- 1..24
2
- ok 1
3
- ok 2
4
- ok 3
5
- not ok 4
6
- # Failed test at t/simple.c line 8.
7
- ok 5 - foo
8
- ok 6 - bar
9
- ok 7 - baz
10
- ok 8 - quux
11
- ok 9 - thud
12
- ok 10 - wombat
13
- ok 11 - blurgle
14
- ok 12 - frob
15
- not ok 13 - frobnicate
16
- # Failed test 'frobnicate'
17
- # at t/simple.c line 17.
18
- ok 14 - eek
19
- ok 15 - ook
20
- ok 16 - frodo
21
- ok 17 - bilbo
22
- ok 18 - wubble
23
- ok 19 - flarp
24
- ok 20 - fnord
25
- ok 21
26
- not ok 22
27
- # Failed test at t/simple.c line 26.
28
- ok 23 - good
29
- not ok 24 - bad
30
- # Failed test 'bad'
31
- # at t/simple.c line 28.
32
- # Looks like you failed 4 tests of 24 run.