aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/array_size_ut.cpp
blob: 14283c161027bdd542221e7927c4c6216b73ac7c (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);
    }
} // Y_UNIT_TEST_SUITE(ArraySizeTest)