Coverage Report

Created: 2019-07-03 22:50

/home/liu/buildslave/linux-x64-runtests/build/test/unit/nnc/tfb.tests.c
Line
Count
Source
1
#include <stddef.h>
2
3
#include "ccv.h"
4
#include "case.h"
5
#include "ccv_case.h"
6
#include "nnc/ccv_nnc.h"
7
8
TEST_SETUP()
9
{
10
  ccv_nnc_init();
11
}
12
13
#if CCV_NNC_TENSOR_TFB
14
TEST_CASE("toll-free bridging between ccv_nnc_tensor_t and ccv_dense_matrix_t")
15
1
{
16
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, type) == offsetof(ccv_dense_matrix_t, type), "type offset should be the same");
17
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, sig) == offsetof(ccv_dense_matrix_t, sig), "sig offset should be the same");
18
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, refcount) == offsetof(ccv_dense_matrix_t, refcount), "refcount offset should be the same");
19
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, data) == offsetof(ccv_dense_matrix_t, data), "data offset should be the same");
20
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, type) == offsetof(ccv_dense_matrix_t, resides), "info.type and resides offset should be the same");
21
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, format) == offsetof(ccv_dense_matrix_t, format), "info.format and format offset should be the same");
22
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, datatype) == offsetof(ccv_dense_matrix_t, datatype), "info.datatype and datatype offset should be the same");
23
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, dim) == offsetof(ccv_dense_matrix_t, rows), "info.dim[0] and rows offset should be the same");
24
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, dim) + sizeof(int) * 3 == offsetof(ccv_dense_matrix_t, reserved1), "info.dim[3] and reserved offset should be the same");
25
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) + offsetof(ccv_nnc_tensor_param_t, dim) + sizeof(int) * 4 == offsetof(ccv_dense_matrix_t, step), "info.dim[4] and step offset should be the same");
26
1
}
27
#endif
28
29
TEST_CASE("toll-free bridging between ccv_nnc_tensor_t and ccv_nnc_tensor_view_t")
30
1
{
31
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, type) == offsetof(ccv_nnc_tensor_view_t, type), "type offset should be the same");
32
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, sig) == offsetof(ccv_nnc_tensor_view_t, sig), "sig offset should be the same");
33
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, refcount) == offsetof(ccv_nnc_tensor_view_t, refcount), "refcount offset should be the same");
34
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, data) == offsetof(ccv_nnc_tensor_view_t, data), "data offset should be the same");
35
1
  REQUIRE(offsetof(ccv_nnc_tensor_t, info) == offsetof(ccv_nnc_tensor_view_t, info), "info offset should be the same");
36
1
}
37
38
#include "case_main.h"