blob: 19e40cef4605004b69b282f72cf6268e57f84e2a (
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);
}
}
|