aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/array_size_ut.cpp
blob: 13f45903c51e5227db37398ca421e05d2c1de45a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "array_size.h"

#include <library/cpp/testing/unittest/registar.h>

Y_UNIT_TEST_SUITE(ArraySizeTest) {
    Y_UNIT_TEST(Test1) {
        int x[100];
        Y_UNUSED(x); /* Make MSVC happy. */

        UNIT_ASSERT_VALUES_EQUAL(Y_ARRAY_SIZE(x), 100);
    }

    Y_UNIT_TEST(Test2) {
        struct T {
        };

        T x[1];
        Y_UNUSED(x); /* Make MSVC happy. */

        UNIT_ASSERT_VALUES_EQUAL(Y_ARRAY_SIZE(x), 1);
    }
}