10 #include <type_traits> 13 #include "../../common/tiny-profiler.h" 14 #include "./../src/environment.h" 22 float src_float[] = { 1.1f, 2.2f, 3.3f, -5.5f, 0.f, 123534.f };
23 double src_double[] = { 0.00000000000000000001, -2222222222222222222222222.222222, 334529087543.30875246784, -5.51234533524532345254645234256, 5888985940.4535, -0.0000000000001 };
25 const size_t src_size = 6;
27 float tgt_float[src_size] = { 0 };
28 double tgt_double[src_size] = { 0 };
37 for (
size_t i = 0;
i < src_size; ++
i)
42 REQUIRE(src_float[i] == (tgt_float[i]));
43 REQUIRE(src_float[i] == (tgt_double[i]));
47 memset(&tgt_float, 0,
sizeof(
float)*src_size);
48 elem = librealsense::copy_array<true>(tgt_float, src_double);
51 for (
size_t i = 0;
i < src_size; ++
i)
55 REQUIRE(src_double[i] != tgt_float[i]);
62 float src_float[2][6] = { { 1.1f, 2.2f, 3.3f, -5.5f, 0.f, 123534.f },
63 { 764.07f, -2342.2f, 2453.653f, -445.215f, 0.11324f, 1224.8209f } };
64 double src_double[2][6] = { { -254354352341.1, 765732052.21124, 3.4432007654764633233554, -524432.5432650645, 0.0000000000000000112, 123534.4234254673 },
65 { 764.07654343263, -242675463465342.243, -9876322453.6342453, -42315432545.2153542, 0.1345521543251324, -0.0000123413242329 } };
67 const size_t src_size =
arr_size(src_float);
73 float tgt_float[2][6] = { 0 };
74 double tgt_double[2][6] = { 0 };
82 for (
size_t i = 0;
i <
h; ++
i)
83 for (
size_t j = 0;
j <
w; ++
j)
88 REQUIRE(src_float[
i][j] == (tgt_float[
i][j]));
89 REQUIRE(src_float[
i][j] == (tgt_double[
i][j]));
93 memset(&tgt_float, 0,
sizeof(
float)*src_size);
94 elem = librealsense::copy_2darray<true>(tgt_float, src_double);
97 for (
size_t i = 0;
i <
h; ++
i)
98 for (
size_t j = 0;
j <
w; ++
j)
102 REQUIRE(src_double[
i][j] != tgt_float[
i][j]);
GLdouble GLdouble GLdouble w
GLfloat GLfloat GLfloat GLfloat h
constexpr size_t arr_size(T const &)
TEST_CASE("copy_array","[code]")
size_t copy_2darray(T(&dst)[tgt_m][tgt_n], const S(&src)[src_m][src_n])
size_t copy_array(T(&dst)[size_tgt], const S(&src)[size_src])