Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / tests / SkSLTypeTest.cpp
1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7
8 #include "include/sksl/SkSLErrorReporter.h"
9 #include "src/gpu/ganesh/GrShaderCaps.h"
10 #include "src/sksl/SkSLBuiltinTypes.h"
11 #include "src/sksl/SkSLContext.h"
12 #include "src/sksl/SkSLMangler.h"
13 #include "src/sksl/ir/SkSLType.h"
14 #include "tests/Test.h"
15
16 #include <cstdint>
17 #include <limits>
18 #include <memory>
19
20 DEF_TEST(SkSLTypeLimits, r) {
21     GrShaderCaps caps;
22     SkSL::TestingOnly_AbortErrorReporter errors;
23     SkSL::Mangler mangler;
24     SkSL::Context context(errors, caps, mangler);
25
26     using int_limits = std::numeric_limits<int32_t>;
27     REPORTER_ASSERT(r, context.fTypes.fInt->minimumValue() == int_limits::min());
28     REPORTER_ASSERT(r, context.fTypes.fInt->maximumValue() == int_limits::max());
29
30     using short_limits = std::numeric_limits<int16_t>;
31     REPORTER_ASSERT(r, context.fTypes.fShort->minimumValue() == short_limits::min());
32     REPORTER_ASSERT(r, context.fTypes.fShort->maximumValue() == short_limits::max());
33
34     using uint_limits = std::numeric_limits<uint32_t>;
35     REPORTER_ASSERT(r, context.fTypes.fUInt->minimumValue() == uint_limits::min());
36     REPORTER_ASSERT(r, context.fTypes.fUInt->maximumValue() == uint_limits::max());
37
38     using ushort_limits = std::numeric_limits<uint16_t>;
39     REPORTER_ASSERT(r, context.fTypes.fUShort->minimumValue() == ushort_limits::min());
40     REPORTER_ASSERT(r, context.fTypes.fUShort->maximumValue() == ushort_limits::max());
41 }