/home/liu/actions-runner/_work/ccv/ccv/test/ccv_case.h
Line | Count | Source |
1 | | #ifndef _GUARD_ccv_case_h_ |
2 | | #define _GUARD_ccv_case_h_ |
3 | | |
4 | | #include <math.h> |
5 | | #include <assert.h> |
6 | | #include <string.h> |
7 | | #include <sys/stat.h> |
8 | | |
9 | | static inline int ccv_is_coverage(void) |
10 | 6 | { |
11 | 6 | #ifdef COVERAGE_TESTS |
12 | 6 | return 1; |
13 | | #else |
14 | | return 0; |
15 | | #endif |
16 | 6 | } Unexecuted instantiation: util.tests.c:ccv_is_coverage Unexecuted instantiation: basic.tests.c:ccv_is_coverage Unexecuted instantiation: transform.tests.c:ccv_is_coverage Unexecuted instantiation: image_processing.tests.c:ccv_is_coverage Unexecuted instantiation: 3rdparty.tests.c:ccv_is_coverage Unexecuted instantiation: io.tests.c:ccv_is_coverage Unexecuted instantiation: gradient.tests.c:ccv_is_coverage Unexecuted instantiation: upsample.tests.c:ccv_is_coverage Unexecuted instantiation: palettize.tests.c:ccv_is_coverage Unexecuted instantiation: concat.tests.c:ccv_is_coverage Unexecuted instantiation: pad.tests.c:ccv_is_coverage Unexecuted instantiation: tensor.bind.tests.c:ccv_is_coverage Unexecuted instantiation: backward.tests.c:ccv_is_coverage Unexecuted instantiation: graph.tests.c:ccv_is_coverage Unexecuted instantiation: case_of.backward.tests.c:ccv_is_coverage Unexecuted instantiation: while.backward.tests.c:ccv_is_coverage Unexecuted instantiation: autograd.vector.tests.c:ccv_is_coverage Unexecuted instantiation: dropout.tests.c:ccv_is_coverage Unexecuted instantiation: custom.tests.c:ccv_is_coverage Unexecuted instantiation: reduce.tests.c:ccv_is_coverage Unexecuted instantiation: tfb.tests.c:ccv_is_coverage Unexecuted instantiation: batch.norm.tests.c:ccv_is_coverage Unexecuted instantiation: crossentropy.tests.c:ccv_is_coverage Unexecuted instantiation: cnnp.core.tests.c:ccv_is_coverage Unexecuted instantiation: symbolic.graph.tests.c:ccv_is_coverage Unexecuted instantiation: group.norm.tests.c:ccv_is_coverage Unexecuted instantiation: case_of.tests.c:ccv_is_coverage Unexecuted instantiation: micro.tests.c:ccv_is_coverage Unexecuted instantiation: compression.tests.c:ccv_is_coverage Unexecuted instantiation: dataframe.tests.c:ccv_is_coverage Unexecuted instantiation: gemm.tests.c:ccv_is_coverage Unexecuted instantiation: roi_align.tests.c:ccv_is_coverage Unexecuted instantiation: complex.tests.c:ccv_is_coverage Unexecuted instantiation: swish.tests.c:ccv_is_coverage Unexecuted instantiation: index.tests.c:ccv_is_coverage Unexecuted instantiation: minimize.tests.c:ccv_is_coverage Unexecuted instantiation: symbolic.graph.compile.tests.c:ccv_is_coverage Unexecuted instantiation: histogram.tests.c:ccv_is_coverage Unexecuted instantiation: rmsnorm.tests.c:ccv_is_coverage Unexecuted instantiation: autograd.tests.c:ccv_is_coverage Unexecuted instantiation: tensor.tests.c:ccv_is_coverage Unexecuted instantiation: rand.tests.c:ccv_is_coverage Unexecuted instantiation: while.tests.c:ccv_is_coverage Unexecuted instantiation: nms.tests.c:ccv_is_coverage Unexecuted instantiation: graph.io.tests.c:ccv_is_coverage Unexecuted instantiation: cblas.tests.c:ccv_is_coverage Unexecuted instantiation: simplify.tests.c:ccv_is_coverage Unexecuted instantiation: gelu.tests.c:ccv_is_coverage Unexecuted instantiation: numa.tests.c:ccv_is_coverage Unexecuted instantiation: loss.tests.c:ccv_is_coverage Unexecuted instantiation: tape.tests.c:ccv_is_coverage Unexecuted instantiation: dynamic.graph.tests.c:ccv_is_coverage Unexecuted instantiation: layer.norm.tests.c:ccv_is_coverage Unexecuted instantiation: parallel.tests.c:ccv_is_coverage Unexecuted instantiation: winograd.tests.c:ccv_is_coverage Unexecuted instantiation: dataframe.addons.tests.c:ccv_is_coverage Unexecuted instantiation: attention.tests.c:ccv_is_coverage Unexecuted instantiation: broadcast.tests.c:ccv_is_coverage Unexecuted instantiation: compare.tests.c:ccv_is_coverage Unexecuted instantiation: smooth_l1.tests.c:ccv_is_coverage Unexecuted instantiation: forward.tests.c:ccv_is_coverage Unexecuted instantiation: output.tests.c:ccv_is_coverage Unexecuted instantiation: convnet.tests.c:ccv_is_coverage Unexecuted instantiation: numeric.tests.c:ccv_is_coverage Unexecuted instantiation: defects.l0.1.tests.c:ccv_is_coverage Unexecuted instantiation: cublas.tests.c:ccv_is_coverage Unexecuted instantiation: mpsblas.tests.c:ccv_is_coverage Unexecuted instantiation: symbolic.graph.vgg.d.tests.c:ccv_is_coverage imdb.tests.c:ccv_is_coverage Line | Count | Source | 10 | 3 | { | 11 | 3 | #ifdef COVERAGE_TESTS | 12 | 3 | return 1; | 13 | | #else | 14 | | return 0; | 15 | | #endif | 16 | 3 | } |
Unexecuted instantiation: lstm.tests.c:ccv_is_coverage Unexecuted instantiation: datatype.tests.c:ccv_is_coverage Unexecuted instantiation: graph.vgg.d.tests.c:ccv_is_coverage Unexecuted instantiation: leaky_relu.tests.c:ccv_is_coverage Unexecuted instantiation: random.tests.c:ccv_is_coverage Unexecuted instantiation: cudnn.tests.c:ccv_is_coverage Unexecuted instantiation: dense.net.tests.c:ccv_is_coverage cifar.tests.c:ccv_is_coverage Line | Count | Source | 10 | 3 | { | 11 | 3 | #ifdef COVERAGE_TESTS | 12 | 3 | return 1; | 13 | | #else | 14 | | return 0; | 15 | | #endif | 16 | 3 | } |
Unexecuted instantiation: rmsprop.tests.c:ccv_is_coverage Unexecuted instantiation: sgd.tests.c:ccv_is_coverage Unexecuted instantiation: nccl.tests.c:ccv_is_coverage Unexecuted instantiation: schedule.tests.c:ccv_is_coverage Unexecuted instantiation: mpsdnn.tests.c:ccv_is_coverage Unexecuted instantiation: adam.tests.c:ccv_is_coverage Unexecuted instantiation: lamb.tests.c:ccv_is_coverage |
17 | | |
18 | 53 | #define REQUIRE_MATRIX_EQ(a, b, err, ...) { \ |
19 | 53 | if (ccv_matrix_eq(a, b) != 0) \ |
20 | 0 | { \ |
21 | 0 | if (isatty(fileno(stdout))) \ |
22 | 0 | printf("\n\t\033[0;31mREQUIRE_MATRIX_EQ\033[0;0m: %s:%d: %s != %s, " err, __FILE__, __LINE__, #a, #b, ##__VA_ARGS__); \ |
23 | 0 | else \ |
24 | 0 | printf("\n\tREQUIRE_MATRIX_EQ: %s:%d: %s != %s, " err, __FILE__, __LINE__, #a, #b, ##__VA_ARGS__); \ |
25 | 0 | ABORT_CASE; \ |
26 | 0 | } } |
27 | | |
28 | 38 | #define REQUIRE_MATRIX_FILE_EQ(a, f, err, ...) { \ |
29 | 38 | ccv_dense_matrix_t* __case_b__ = 0; \ |
30 | 38 | ccv_read(f, &__case_b__, CCV_IO_ANY_FILE); \ |
31 | 38 | if (ccv_matrix_eq(a, __case_b__) != 0) \ |
32 | 0 | { \ |
33 | 0 | if (isatty(fileno(stdout))) \ |
34 | 0 | printf("\n\t\033[0;31mREQUIRE_MATRIX_FILE_EQ\033[0;0m: %s:%d: %s != %s, " err, __FILE__, __LINE__, #a, #f, ##__VA_ARGS__); \ |
35 | 0 | else \ |
36 | 0 | printf("\n\tREQUIRE_MATRIX_FILE_EQ: %s:%d: %s != %s, " err, __FILE__, __LINE__, #a, #f, ##__VA_ARGS__); \ |
37 | 0 | ccv_matrix_free(__case_b__); \ |
38 | 0 | ABORT_CASE; \ |
39 | 38 | } \ |
40 | 38 | ccv_matrix_free(__case_b__); } |
41 | | |
42 | 10 | #define REQUIRE_ARRAY_EQ_WITHIN_ANGLE_AND_MAGNITUDE(type, a, b, len, angle, magnitude, err, ...) { \ |
43 | 10 | int __case_i__; \ |
44 | 10 | double __dot_prod__ = 0, __mag_a__ = 0, __mag_b__ = 0; \ |
45 | 1.44k | for (__case_i__ = 0; __case_i__ < (len); __case_i__++1.43k ) \ |
46 | 1.43k | { \ |
47 | 1.43k | __dot_prod__ += (double)(((type*)(a))[__case_i__] * ((type*)(b))[__case_i__]); \ |
48 | 1.43k | __mag_a__ += (double)(((type*)(a))[__case_i__] * ((type*)(a))[__case_i__]); \ |
49 | 1.43k | __mag_b__ += (double)(((type*)(b))[__case_i__] * ((type*)(b))[__case_i__]); \ |
50 | 1.43k | } \ |
51 | 10 | __mag_a__ = sqrt(__mag_a__), __mag_b__ = sqrt(__mag_b__); \ |
52 | 10 | if (acos(__dot_prod__ / (__mag_a__ * __mag_b__)) * 180 / 3.141592653 > angle || fabs(__mag_a__ - __mag_b__) / ccv_max(ccv_max(__mag_a__, __mag_b__), 1) > magnitude) \ |
53 | 0 | { \ |
54 | 0 | if (isatty(fileno(stdout))) \ |
55 | 0 | printf("\n\t\033[0;31mREQUIRE_ARRAY_EQ_WITHIN_ANGLE_AND_MAGNITUDE\033[0;0m: %s:%d: angle: %lg | %lg, magnitude: %lg != %lg | +-%lg, " err, __FILE__, __LINE__, (double)(acos(__dot_prod__ / (__mag_a__ * __mag_b__)) * 180 / 3.141592653), (double)angle, __mag_a__, __mag_b__, (double)(magnitude), ##__VA_ARGS__); \ |
56 | 0 | else \ |
57 | 0 | printf("\n\tREQUIRE_ARRAY_EQ_WITHIN_ANGLE_AND_MAGNITUDE: %s:%d: angle: %lg | %lg, magnitude: %lg != %lg | +-%lg, " err, __FILE__, __LINE__, (double)(acos(__dot_prod__ / (__mag_a__ * __mag_b__)) * 180 / 3.141592653), (double)angle, __mag_a__, __mag_b__, (double)(magnitude), ##__VA_ARGS__); \ |
58 | 0 | ABORT_CASE; \ |
59 | 0 | } } |
60 | | |
61 | | #endif |