MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

util/system/unaligned_mem_ut.cpp:33–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32Y_UNIT_TEST_SUITE(UnalignedMem) {
33 Y_UNIT_TEST(TestReadWrite) {
34 alignas(ui64) char buf[100];
35
36 WriteUnaligned<ui16>(buf + 1, (ui16)1);
37 WriteUnaligned<ui32>(buf + 1 + 2, (ui32)2);
38 WriteUnaligned<ui64>(buf + 1 + 2 + 4, (ui64)3);
39
40 UNIT_ASSERT_VALUES_EQUAL(ReadUnaligned<ui16>(buf + 1), 1);
41 UNIT_ASSERT_VALUES_EQUAL(ReadUnaligned<ui32>(buf + 1 + 2), 2);
42 UNIT_ASSERT_VALUES_EQUAL(ReadUnaligned<ui64>(buf + 1 + 2 + 4), 3);
43 }
44
45 Y_UNIT_TEST(TestReadWriteRuntime) {
46 // Unlike the test above, this test avoids compile-time execution by a smart compiler.

Callers

nothing calls this directly

Calls 4

ClobberFunction · 0.85
HighMethod · 0.80
MaxFunction · 0.50
LowMethod · 0.45

Tested by

no test coverage detected