2 * Copyright 2021 Google LLC
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
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"
20 DEF_TEST(SkSLTypeLimits, r) {
22 SkSL::TestingOnly_AbortErrorReporter errors;
23 SkSL::Mangler mangler;
24 SkSL::Context context(errors, caps, mangler);
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());
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());
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());
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());