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

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

Y_UNIT_TEST_SUITE(TestTypes) {
    Y_UNIT_TEST(TestScanf) {
        i32 val32 = 0;
        sscanf("-123", "%" SCNi32, &val32);
        UNIT_ASSERT(val32 == -123);
        sscanf("234", "%" SCNu32, &val32);
        UNIT_ASSERT(val32 == 234);
        sscanf("159", "%" SCNx32, &val32);
        UNIT_ASSERT(val32 == 345);

        i64 val64 = 0;
        sscanf("-123", "%" SCNi64, &val64);
        UNIT_ASSERT(val64 == -123);
        sscanf("234", "%" SCNu64, &val64);
        UNIT_ASSERT(val64 == 234);
        sscanf("159", "%" SCNx64, &val64);
        UNIT_ASSERT(val64 == 345);
    }
} // Y_UNIT_TEST_SUITE(TestTypes)