minimap2 0.2.25.1 → 0.2.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/ext/Rakefile +2 -2
- data/ext/minimap2/NEWS.md +9 -0
- data/ext/minimap2/README.md +2 -2
- data/ext/minimap2/cookbook.md +2 -2
- data/ext/minimap2/minimap.h +1 -1
- data/ext/minimap2/minimap2.1 +1 -1
- data/ext/minimap2/misc/paftools.js +1 -1
- data/ext/minimap2/python/mappy.pyx +1 -1
- data/ext/minimap2/setup.py +22 -32
- data/lib/minimap2/version.rb +1 -1
- metadata +1 -97
- data/ext/minimap2/lib/simde/CONTRIBUTING.md +0 -114
- data/ext/minimap2/lib/simde/COPYING +0 -20
- data/ext/minimap2/lib/simde/README.md +0 -333
- data/ext/minimap2/lib/simde/amalgamate.py +0 -58
- data/ext/minimap2/lib/simde/meson.build +0 -33
- data/ext/minimap2/lib/simde/netlify.toml +0 -20
- data/ext/minimap2/lib/simde/simde/arm/neon/float32x2.h +0 -140
- data/ext/minimap2/lib/simde/simde/arm/neon/float32x4.h +0 -137
- data/ext/minimap2/lib/simde/simde/arm/neon/float64x1.h +0 -142
- data/ext/minimap2/lib/simde/simde/arm/neon/float64x2.h +0 -145
- data/ext/minimap2/lib/simde/simde/arm/neon/int16x4.h +0 -140
- data/ext/minimap2/lib/simde/simde/arm/neon/int16x8.h +0 -145
- data/ext/minimap2/lib/simde/simde/arm/neon/int32x2.h +0 -140
- data/ext/minimap2/lib/simde/simde/arm/neon/int32x4.h +0 -143
- data/ext/minimap2/lib/simde/simde/arm/neon/int64x1.h +0 -137
- data/ext/minimap2/lib/simde/simde/arm/neon/int64x2.h +0 -141
- data/ext/minimap2/lib/simde/simde/arm/neon/int8x16.h +0 -147
- data/ext/minimap2/lib/simde/simde/arm/neon/int8x8.h +0 -141
- data/ext/minimap2/lib/simde/simde/arm/neon/uint16x4.h +0 -134
- data/ext/minimap2/lib/simde/simde/arm/neon/uint16x8.h +0 -138
- data/ext/minimap2/lib/simde/simde/arm/neon/uint32x2.h +0 -134
- data/ext/minimap2/lib/simde/simde/arm/neon/uint32x4.h +0 -137
- data/ext/minimap2/lib/simde/simde/arm/neon/uint64x1.h +0 -131
- data/ext/minimap2/lib/simde/simde/arm/neon/uint64x2.h +0 -135
- data/ext/minimap2/lib/simde/simde/arm/neon/uint8x16.h +0 -141
- data/ext/minimap2/lib/simde/simde/arm/neon/uint8x8.h +0 -135
- data/ext/minimap2/lib/simde/simde/arm/neon.h +0 -97
- data/ext/minimap2/lib/simde/simde/check.h +0 -267
- data/ext/minimap2/lib/simde/simde/debug-trap.h +0 -83
- data/ext/minimap2/lib/simde/simde/hedley.h +0 -1899
- data/ext/minimap2/lib/simde/simde/simde-arch.h +0 -445
- data/ext/minimap2/lib/simde/simde/simde-common.h +0 -697
- data/ext/minimap2/lib/simde/simde/x86/avx.h +0 -5385
- data/ext/minimap2/lib/simde/simde/x86/avx2.h +0 -2402
- data/ext/minimap2/lib/simde/simde/x86/avx512bw.h +0 -391
- data/ext/minimap2/lib/simde/simde/x86/avx512f.h +0 -3389
- data/ext/minimap2/lib/simde/simde/x86/avx512vl.h +0 -112
- data/ext/minimap2/lib/simde/simde/x86/fma.h +0 -659
- data/ext/minimap2/lib/simde/simde/x86/mmx.h +0 -2210
- data/ext/minimap2/lib/simde/simde/x86/sse.h +0 -3696
- data/ext/minimap2/lib/simde/simde/x86/sse2.h +0 -5991
- data/ext/minimap2/lib/simde/simde/x86/sse3.h +0 -343
- data/ext/minimap2/lib/simde/simde/x86/sse4.1.h +0 -1783
- data/ext/minimap2/lib/simde/simde/x86/sse4.2.h +0 -105
- data/ext/minimap2/lib/simde/simde/x86/ssse3.h +0 -1053
- data/ext/minimap2/lib/simde/simde/x86/svml.h +0 -543
- data/ext/minimap2/lib/simde/test/CMakeLists.txt +0 -166
- data/ext/minimap2/lib/simde/test/arm/meson.build +0 -4
- data/ext/minimap2/lib/simde/test/arm/neon/meson.build +0 -23
- data/ext/minimap2/lib/simde/test/arm/neon/skel.c +0 -871
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon-internal.h +0 -134
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon.c +0 -39
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon.h +0 -10
- data/ext/minimap2/lib/simde/test/arm/neon/vadd.c +0 -1260
- data/ext/minimap2/lib/simde/test/arm/neon/vdup_n.c +0 -873
- data/ext/minimap2/lib/simde/test/arm/neon/vmul.c +0 -1084
- data/ext/minimap2/lib/simde/test/arm/neon/vsub.c +0 -1260
- data/ext/minimap2/lib/simde/test/arm/test-arm-internal.h +0 -18
- data/ext/minimap2/lib/simde/test/arm/test-arm.c +0 -20
- data/ext/minimap2/lib/simde/test/arm/test-arm.h +0 -8
- data/ext/minimap2/lib/simde/test/cmake/AddCompilerFlags.cmake +0 -171
- data/ext/minimap2/lib/simde/test/cmake/ExtraWarningFlags.cmake +0 -68
- data/ext/minimap2/lib/simde/test/meson.build +0 -64
- data/ext/minimap2/lib/simde/test/munit/COPYING +0 -21
- data/ext/minimap2/lib/simde/test/munit/Makefile +0 -55
- data/ext/minimap2/lib/simde/test/munit/README.md +0 -54
- data/ext/minimap2/lib/simde/test/munit/example.c +0 -351
- data/ext/minimap2/lib/simde/test/munit/meson.build +0 -37
- data/ext/minimap2/lib/simde/test/munit/munit.c +0 -2055
- data/ext/minimap2/lib/simde/test/munit/munit.h +0 -535
- data/ext/minimap2/lib/simde/test/run-tests.c +0 -20
- data/ext/minimap2/lib/simde/test/run-tests.h +0 -260
- data/ext/minimap2/lib/simde/test/x86/avx.c +0 -13752
- data/ext/minimap2/lib/simde/test/x86/avx2.c +0 -9977
- data/ext/minimap2/lib/simde/test/x86/avx512bw.c +0 -2664
- data/ext/minimap2/lib/simde/test/x86/avx512f.c +0 -10416
- data/ext/minimap2/lib/simde/test/x86/avx512vl.c +0 -210
- data/ext/minimap2/lib/simde/test/x86/fma.c +0 -2557
- data/ext/minimap2/lib/simde/test/x86/meson.build +0 -33
- data/ext/minimap2/lib/simde/test/x86/mmx.c +0 -2878
- data/ext/minimap2/lib/simde/test/x86/skel.c +0 -2984
- data/ext/minimap2/lib/simde/test/x86/sse.c +0 -5121
- data/ext/minimap2/lib/simde/test/x86/sse2.c +0 -9860
- data/ext/minimap2/lib/simde/test/x86/sse3.c +0 -486
- data/ext/minimap2/lib/simde/test/x86/sse4.1.c +0 -3446
- data/ext/minimap2/lib/simde/test/x86/sse4.2.c +0 -101
- data/ext/minimap2/lib/simde/test/x86/ssse3.c +0 -2084
- data/ext/minimap2/lib/simde/test/x86/svml.c +0 -1545
- data/ext/minimap2/lib/simde/test/x86/test-avx.h +0 -16
- data/ext/minimap2/lib/simde/test/x86/test-avx512.h +0 -25
- data/ext/minimap2/lib/simde/test/x86/test-mmx.h +0 -13
- data/ext/minimap2/lib/simde/test/x86/test-sse.h +0 -13
- data/ext/minimap2/lib/simde/test/x86/test-sse2.h +0 -13
- data/ext/minimap2/lib/simde/test/x86/test-x86-internal.h +0 -196
- data/ext/minimap2/lib/simde/test/x86/test-x86.c +0 -48
- data/ext/minimap2/lib/simde/test/x86/test-x86.h +0 -8
@@ -1,351 +0,0 @@
|
|
1
|
-
/* Example file for using µnit.
|
2
|
-
*
|
3
|
-
* µnit is MIT-licensed, but for this file and this file alone:
|
4
|
-
*
|
5
|
-
* To the extent possible under law, the author(s) of this file have
|
6
|
-
* waived all copyright and related or neighboring rights to this
|
7
|
-
* work. See <https://creativecommons.org/publicdomain/zero/1.0/> for
|
8
|
-
* details.
|
9
|
-
*********************************************************************/
|
10
|
-
|
11
|
-
#include "munit.h"
|
12
|
-
|
13
|
-
/* This is just to disable an MSVC warning about conditional
|
14
|
-
* expressions being constant, which you shouldn't have to do for your
|
15
|
-
* code. It's only here because we want to be able to do silly things
|
16
|
-
* like assert that 0 != 1 for our demo. */
|
17
|
-
#if defined(_MSC_VER)
|
18
|
-
#pragma warning(disable: 4127)
|
19
|
-
#endif
|
20
|
-
|
21
|
-
/* Tests are functions that return void, and take a single void*
|
22
|
-
* parameter. We'll get to what that parameter is later. */
|
23
|
-
static MunitResult
|
24
|
-
test_compare(const MunitParameter params[], void* data) {
|
25
|
-
/* We'll use these later */
|
26
|
-
const unsigned char val_uchar = 'b';
|
27
|
-
const short val_short = 1729;
|
28
|
-
double pi = 3.141592654;
|
29
|
-
char* stewardesses = "stewardesses";
|
30
|
-
char* most_fun_word_to_type;
|
31
|
-
|
32
|
-
/* These are just to silence compiler warnings about the parameters
|
33
|
-
* being unused. */
|
34
|
-
(void) params;
|
35
|
-
(void) data;
|
36
|
-
|
37
|
-
/* Let's start with the basics. */
|
38
|
-
munit_assert(0 != 1);
|
39
|
-
|
40
|
-
/* There is also the more verbose, though slightly more descriptive
|
41
|
-
munit_assert_true/false: */
|
42
|
-
munit_assert_false(0);
|
43
|
-
|
44
|
-
/* You can also call munit_error and munit_errorf yourself. We
|
45
|
-
* won't do it is used to indicate a failure, but here is what it
|
46
|
-
* would look like: */
|
47
|
-
/* munit_error("FAIL"); */
|
48
|
-
/* munit_errorf("Goodbye, cruel %s", "world"); */
|
49
|
-
|
50
|
-
/* There are macros for comparing lots of types. */
|
51
|
-
munit_assert_char('a', ==, 'a');
|
52
|
-
|
53
|
-
/* Sure, you could just assert('a' == 'a'), but if you did that, a
|
54
|
-
* failed assertion would just say something like "assertion failed:
|
55
|
-
* val_uchar == 'b'". µnit will tell you the actual values, so a
|
56
|
-
* failure here would result in something like "assertion failed:
|
57
|
-
* val_uchar == 'b' ('X' == 'b')." */
|
58
|
-
munit_assert_uchar(val_uchar, ==, 'b');
|
59
|
-
|
60
|
-
/* Obviously we can handle values larger than 'char' and 'uchar'.
|
61
|
-
* There are versions for char, short, int, long, long long,
|
62
|
-
* int8/16/32/64_t, as well as the unsigned versions of them all. */
|
63
|
-
munit_assert_short(42, <, val_short);
|
64
|
-
|
65
|
-
/* There is also support for size_t.
|
66
|
-
*
|
67
|
-
* The longest word in English without repeating any letters is
|
68
|
-
* "uncopyrightables", which has uncopyrightable (and
|
69
|
-
* dermatoglyphics, which is the study of fingerprints) beat by a
|
70
|
-
* character */
|
71
|
-
munit_assert_size(strlen("uncopyrightables"), >, strlen("dermatoglyphics"));
|
72
|
-
|
73
|
-
/* Of course there is also support for doubles and floats. */
|
74
|
-
munit_assert_double(pi, ==, 3.141592654);
|
75
|
-
|
76
|
-
/* If you want to compare two doubles for equality, you might want
|
77
|
-
* to consider using munit_assert_double_equal. It compares two
|
78
|
-
* doubles for equality within a precison of 1.0 x 10^-(precision).
|
79
|
-
* Note that precision (the third argument to the macro) needs to be
|
80
|
-
* fully evaluated to an integer by the preprocessor so µnit doesn't
|
81
|
-
* have to depend pow, which is often in libm not libc. */
|
82
|
-
munit_assert_double_equal(3.141592654, 3.141592653589793, 9);
|
83
|
-
|
84
|
-
/* And if you want to check strings for equality (or inequality),
|
85
|
-
* there is munit_assert_string_equal/not_equal.
|
86
|
-
*
|
87
|
-
* "stewardesses" is the longest word you can type on a QWERTY
|
88
|
-
* keyboard with only one hand, which makes it loads of fun to type.
|
89
|
-
* If I'm going to have to type a string repeatedly, let's make it a
|
90
|
-
* good one! */
|
91
|
-
munit_assert_string_equal(stewardesses, "stewardesses");
|
92
|
-
|
93
|
-
/* A personal favorite macro which is fantastic if you're working
|
94
|
-
* with binary data, is the one which naïvely checks two blobs of
|
95
|
-
* memory for equality. If this fails it will tell you the offset
|
96
|
-
* of the first differing byte. */
|
97
|
-
munit_assert_memory_equal(7, stewardesses, "steward");
|
98
|
-
|
99
|
-
/* You can also make sure that two blobs differ *somewhere*: */
|
100
|
-
munit_assert_memory_not_equal(8, stewardesses, "steward");
|
101
|
-
|
102
|
-
/* There are equal/not_equal macros for pointers, too: */
|
103
|
-
most_fun_word_to_type = stewardesses;
|
104
|
-
munit_assert_ptr_equal(most_fun_word_to_type, stewardesses);
|
105
|
-
|
106
|
-
/* And null/not_null */
|
107
|
-
munit_assert_null(NULL);
|
108
|
-
munit_assert_not_null(most_fun_word_to_type);
|
109
|
-
|
110
|
-
/* Lets verify that the data parameter is what we expected. We'll
|
111
|
-
* see where this comes from in a bit.
|
112
|
-
*
|
113
|
-
* Note that the casting isn't usually required; if you give this
|
114
|
-
* function a real pointer (instead of a number like 0xdeadbeef) it
|
115
|
-
* would work as expected. */
|
116
|
-
munit_assert_ptr_equal(data, (void*)(uintptr_t)0xdeadbeef);
|
117
|
-
|
118
|
-
return MUNIT_OK;
|
119
|
-
}
|
120
|
-
|
121
|
-
static MunitResult
|
122
|
-
test_rand(const MunitParameter params[], void* user_data) {
|
123
|
-
int random_int;
|
124
|
-
double random_dbl;
|
125
|
-
munit_uint8_t data[5];
|
126
|
-
|
127
|
-
(void) params;
|
128
|
-
(void) user_data;
|
129
|
-
|
130
|
-
/* One thing missing from a lot of unit testing frameworks is a
|
131
|
-
* random number generator. You can't just use srand/rand because
|
132
|
-
* the implementation varies across different platforms, and it's
|
133
|
-
* important to be able to look at the seed used in a failing test
|
134
|
-
* to see if you can reproduce it. Some randomness is a fantastic
|
135
|
-
* thing to have in your tests, I don't know why more people don't
|
136
|
-
* do it...
|
137
|
-
*
|
138
|
-
* µnit's PRNG is re-seeded with the same value for each iteration
|
139
|
-
* of each test. The seed is retrieved from the MUNIT_SEED
|
140
|
-
* envirnment variable or, if none is provided, one will be
|
141
|
-
* (pseudo-)randomly generated. */
|
142
|
-
|
143
|
-
/* If you need an integer in a given range */
|
144
|
-
random_int = munit_rand_int_range(128, 4096);
|
145
|
-
munit_assert_int(random_int, >=, 128);
|
146
|
-
munit_assert_int(random_int, <=, 4096);
|
147
|
-
|
148
|
-
/* Or maybe you want a double, between 0 and 1: */
|
149
|
-
random_dbl = munit_rand_double();
|
150
|
-
munit_assert_double(random_dbl, >=, 0.0);
|
151
|
-
munit_assert_double(random_dbl, <=, 1.0);
|
152
|
-
|
153
|
-
/* Of course, you want to be able to reproduce bugs discovered
|
154
|
-
* during testing, so every time the tests are run they print the
|
155
|
-
* random seed used. When you want to reproduce a result, just put
|
156
|
-
* that random seed in the MUNIT_SEED environment variable; it even
|
157
|
-
* works on different platforms.
|
158
|
-
*
|
159
|
-
* If you want this to pass, use 0xdeadbeef as the random seed and
|
160
|
-
* uncomment the next line of code. Note that the PRNG is not
|
161
|
-
* re-seeded between iterations of the same test, so this will only
|
162
|
-
* work on the first iteration. */
|
163
|
-
/* munit_assert_uint32(munit_rand_uint32(), ==, 1306447409); */
|
164
|
-
|
165
|
-
/* You can also get blobs of random memory: */
|
166
|
-
munit_rand_memory(sizeof(data), data);
|
167
|
-
|
168
|
-
return MUNIT_OK;
|
169
|
-
}
|
170
|
-
|
171
|
-
/* This test case shows how to accept parameters. We'll see how to
|
172
|
-
* specify them soon.
|
173
|
-
*
|
174
|
-
* By default, every possible variation of a parameterized test is
|
175
|
-
* run, but you can specify parameters manually if you want to only
|
176
|
-
* run specific test(s), or you can pass the --single argument to the
|
177
|
-
* CLI to have the harness simply choose one variation at random
|
178
|
-
* instead of running them all. */
|
179
|
-
static MunitResult
|
180
|
-
test_parameters(const MunitParameter params[], void* user_data) {
|
181
|
-
const char* foo;
|
182
|
-
const char* bar;
|
183
|
-
|
184
|
-
(void) user_data;
|
185
|
-
|
186
|
-
/* The "foo" parameter is specified as one of the following values:
|
187
|
-
* "one", "two", or "three". */
|
188
|
-
foo = munit_parameters_get(params, "foo");
|
189
|
-
/* Similarly, "bar" is one of "four", "five", or "six". */
|
190
|
-
bar = munit_parameters_get(params, "bar");
|
191
|
-
/* "baz" is a bit more complicated. We don't actually specify a
|
192
|
-
* list of valid values, so by default NULL is passed. However, the
|
193
|
-
* CLI will accept any value. This is a good way to have a value
|
194
|
-
* that is usually selected randomly by the test, but can be
|
195
|
-
* overridden on the command line if desired. */
|
196
|
-
/* const char* baz = munit_parameters_get(params, "baz"); */
|
197
|
-
|
198
|
-
/* Notice that we're returning MUNIT_FAIL instead of writing an
|
199
|
-
* error message. Error messages are generally preferable, since
|
200
|
-
* they make it easier to diagnose the issue, but this is an
|
201
|
-
* option.
|
202
|
-
*
|
203
|
-
* Possible values are:
|
204
|
-
* - MUNIT_OK: Sucess
|
205
|
-
* - MUNIT_FAIL: Failure
|
206
|
-
* - MUNIT_SKIP: The test was skipped; usually this happens when a
|
207
|
-
* particular feature isn't in use. For example, if you're
|
208
|
-
* writing a test which uses a Wayland-only feature, but your
|
209
|
-
* application is running on X11.
|
210
|
-
* - MUNIT_ERROR: The test failed, but not because of anything you
|
211
|
-
* wanted to test. For example, maybe your test downloads a
|
212
|
-
* remote resource and tries to parse it, but the network was
|
213
|
-
* down.
|
214
|
-
*/
|
215
|
-
|
216
|
-
if (strcmp(foo, "one") != 0 &&
|
217
|
-
strcmp(foo, "two") != 0 &&
|
218
|
-
strcmp(foo, "three") != 0)
|
219
|
-
return MUNIT_FAIL;
|
220
|
-
|
221
|
-
if (strcmp(bar, "red") != 0 &&
|
222
|
-
strcmp(bar, "green") != 0 &&
|
223
|
-
strcmp(bar, "blue") != 0)
|
224
|
-
return MUNIT_FAIL;
|
225
|
-
|
226
|
-
return MUNIT_OK;
|
227
|
-
}
|
228
|
-
|
229
|
-
/* The setup function, if you provide one, for a test will be run
|
230
|
-
* before the test, and the return value will be passed as the sole
|
231
|
-
* parameter to the test function. */
|
232
|
-
static void*
|
233
|
-
test_compare_setup(const MunitParameter params[], void* user_data) {
|
234
|
-
(void) params;
|
235
|
-
|
236
|
-
munit_assert_string_equal(user_data, "µnit");
|
237
|
-
return (void*) (uintptr_t) 0xdeadbeef;
|
238
|
-
}
|
239
|
-
|
240
|
-
/* To clean up after a test, you can use a tear down function. The
|
241
|
-
* fixture argument is the value returned by the setup function
|
242
|
-
* above. */
|
243
|
-
static void
|
244
|
-
test_compare_tear_down(void* fixture) {
|
245
|
-
munit_assert_ptr_equal(fixture, (void*)(uintptr_t)0xdeadbeef);
|
246
|
-
}
|
247
|
-
|
248
|
-
static char* foo_params[] = {
|
249
|
-
(char*) "one", (char*) "two", (char*) "three", NULL
|
250
|
-
};
|
251
|
-
|
252
|
-
static char* bar_params[] = {
|
253
|
-
(char*) "red", (char*) "green", (char*) "blue", NULL
|
254
|
-
};
|
255
|
-
|
256
|
-
static MunitParameterEnum test_params[] = {
|
257
|
-
{ (char*) "foo", foo_params },
|
258
|
-
{ (char*) "bar", bar_params },
|
259
|
-
{ (char*) "baz", NULL },
|
260
|
-
{ NULL, NULL },
|
261
|
-
};
|
262
|
-
|
263
|
-
/* Creating a test suite is pretty simple. First, you'll need an
|
264
|
-
* array of tests: */
|
265
|
-
static MunitTest test_suite_tests[] = {
|
266
|
-
{
|
267
|
-
/* The name is just a unique human-readable way to identify the
|
268
|
-
* test. You can use it to run a specific test if you want, but
|
269
|
-
* usually it's mostly decorative. */
|
270
|
-
(char*) "/example/compare",
|
271
|
-
/* You probably won't be surprised to learn that the tests are
|
272
|
-
* functions. */
|
273
|
-
test_compare,
|
274
|
-
/* If you want, you can supply a function to set up a fixture. If
|
275
|
-
* you supply NULL, the user_data parameter from munit_suite_main
|
276
|
-
* will be used directly. If, however, you provide a callback
|
277
|
-
* here the user_data parameter will be passed to this callback,
|
278
|
-
* and the return value from this callback will be passed to the
|
279
|
-
* test function.
|
280
|
-
*
|
281
|
-
* For our example we don't really need a fixture, but lets
|
282
|
-
* provide one anyways. */
|
283
|
-
test_compare_setup,
|
284
|
-
/* If you passed a callback for the fixture setup function, you
|
285
|
-
* may want to pass a corresponding callback here to reverse the
|
286
|
-
* operation. */
|
287
|
-
test_compare_tear_down,
|
288
|
-
/* Finally, there is a bitmask for options you can pass here. You
|
289
|
-
* can provide either MUNIT_TEST_OPTION_NONE or 0 here to use the
|
290
|
-
* defaults. */
|
291
|
-
MUNIT_TEST_OPTION_NONE,
|
292
|
-
NULL
|
293
|
-
},
|
294
|
-
/* Usually this is written in a much more compact format; all these
|
295
|
-
* comments kind of ruin that, though. Here is how you'll usually
|
296
|
-
* see entries written: */
|
297
|
-
{ (char*) "/example/rand", test_rand, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
|
298
|
-
/* To tell the test runner when the array is over, just add a NULL
|
299
|
-
* entry at the end. */
|
300
|
-
{ (char*) "/example/parameters", test_parameters, NULL, NULL, MUNIT_TEST_OPTION_NONE, test_params },
|
301
|
-
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
|
302
|
-
};
|
303
|
-
|
304
|
-
/* If you wanted to have your test suite run other test suites you
|
305
|
-
* could declare an array of them. Of course each sub-suite can
|
306
|
-
* contain more suites, etc. */
|
307
|
-
/* static const MunitSuite other_suites[] = { */
|
308
|
-
/* { "/second", test_suite_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE }, */
|
309
|
-
/* { NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE } */
|
310
|
-
/* }; */
|
311
|
-
|
312
|
-
/* Now we'll actually declare the test suite. You could do this in
|
313
|
-
* the main function, or on the heap, or whatever you want. */
|
314
|
-
static const MunitSuite test_suite = {
|
315
|
-
/* This string will be prepended to all test names in this suite;
|
316
|
-
* for example, "/example/rand" will become "/µnit/example/rand".
|
317
|
-
* Note that, while it doesn't really matter for the top-level
|
318
|
-
* suite, NULL signal the end of an array of tests; you should use
|
319
|
-
* an empty string ("") instead. */
|
320
|
-
(char*) "",
|
321
|
-
/* The first parameter is the array of test suites. */
|
322
|
-
test_suite_tests,
|
323
|
-
/* In addition to containing test cases, suites can contain other
|
324
|
-
* test suites. This isn't necessary in this example, but it can be
|
325
|
-
* a great help to projects with lots of tests by making it easier
|
326
|
-
* to spread the tests across many files. This is where you would
|
327
|
-
* put "other_suites" (which is commented out above). */
|
328
|
-
NULL,
|
329
|
-
/* An interesting feature of µnit is that it supports automatically
|
330
|
-
* running multiple iterations of the tests. This is usually only
|
331
|
-
* interesting if you make use of the PRNG to randomize your tests
|
332
|
-
* cases a bit, or if you are doing performance testing and want to
|
333
|
-
* average multiple runs. 0 is an alias for 1. */
|
334
|
-
1,
|
335
|
-
/* Just like MUNIT_TEST_OPTION_NONE, you can provide
|
336
|
-
* MUNIT_SUITE_OPTION_NONE or 0 to use the default settings. */
|
337
|
-
MUNIT_SUITE_OPTION_NONE
|
338
|
-
};
|
339
|
-
|
340
|
-
/* This is only necessary for EXIT_SUCCESS and EXIT_FAILURE, which you
|
341
|
-
* *should* be using but probably aren't (no, zero and non-zero don't
|
342
|
-
* always mean success and failure). I guess my point is that nothing
|
343
|
-
* about µnit requires it. */
|
344
|
-
#include <stdlib.h>
|
345
|
-
|
346
|
-
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
|
347
|
-
/* Finally, we'll actually run our test suite! That second argument
|
348
|
-
* is the user_data parameter which will be passed either to the
|
349
|
-
* test or (if provided) the fixture setup function. */
|
350
|
-
return munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
|
351
|
-
}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
project('munit', 'c')
|
2
|
-
|
3
|
-
conf_data = configuration_data()
|
4
|
-
conf_data.set('version', '0.2.0')
|
5
|
-
|
6
|
-
add_project_arguments('-std=c99', language : 'c')
|
7
|
-
|
8
|
-
cc = meson.get_compiler('c')
|
9
|
-
|
10
|
-
root_include = include_directories('.')
|
11
|
-
|
12
|
-
munit = library('munit',
|
13
|
-
['munit.c'],
|
14
|
-
install: meson.is_subproject())
|
15
|
-
|
16
|
-
if meson.is_subproject()
|
17
|
-
munit_dep = declare_dependency(
|
18
|
-
include_directories : root_include,
|
19
|
-
link_with : munit)
|
20
|
-
else
|
21
|
-
# standalone install
|
22
|
-
install_headers('munit.h')
|
23
|
-
|
24
|
-
pkg = import('pkgconfig')
|
25
|
-
pkg.generate(name: 'munit',
|
26
|
-
description: 'µnit Testing Library for C',
|
27
|
-
version: conf_data.get('version'),
|
28
|
-
libraries: munit)
|
29
|
-
|
30
|
-
# compile the demo project
|
31
|
-
munit_example_src = files('example.c')
|
32
|
-
munit_example = executable('munit_example', munit_example_src,
|
33
|
-
include_directories: root_include,
|
34
|
-
link_with: munit)
|
35
|
-
|
36
|
-
test('munit example test', munit_example)
|
37
|
-
endif
|