skia2/tests/SkSLTypeTest.cpp
Greg Daniel 719239cd69 Move all Ganesh source files into ganesh subdirectory.
Change-Id: I238d29ba0250224fa593845ae65192653f58faff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/528156
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2022-04-07 21:06:50 +00:00

42 lines
1.5 KiB
C++

/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/sksl/SkSLErrorReporter.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/sksl/SkSLBuiltinTypes.h"
#include "src/sksl/SkSLContext.h"
#include "src/sksl/SkSLMangler.h"
#include "src/sksl/ir/SkSLType.h"
#include "tests/Test.h"
#include <cstdint>
#include <limits>
#include <memory>
DEF_TEST(SkSLTypeLimits, r) {
GrShaderCaps caps;
SkSL::TestingOnly_AbortErrorReporter errors;
SkSL::Mangler mangler;
SkSL::Context context(errors, caps, mangler);
using int_limits = std::numeric_limits<int32_t>;
REPORTER_ASSERT(r, context.fTypes.fInt->minimumValue() == int_limits::min());
REPORTER_ASSERT(r, context.fTypes.fInt->maximumValue() == int_limits::max());
using short_limits = std::numeric_limits<int16_t>;
REPORTER_ASSERT(r, context.fTypes.fShort->minimumValue() == short_limits::min());
REPORTER_ASSERT(r, context.fTypes.fShort->maximumValue() == short_limits::max());
using uint_limits = std::numeric_limits<uint32_t>;
REPORTER_ASSERT(r, context.fTypes.fUInt->minimumValue() == uint_limits::min());
REPORTER_ASSERT(r, context.fTypes.fUInt->maximumValue() == uint_limits::max());
using ushort_limits = std::numeric_limits<uint16_t>;
REPORTER_ASSERT(r, context.fTypes.fUShort->minimumValue() == ushort_limits::min());
REPORTER_ASSERT(r, context.fTypes.fUShort->maximumValue() == ushort_limits::max());
}