Flutter Engine
The Flutter Engine
SkSLTypeTest.cpp
Go to the documentation of this file.
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
10#include "tests/Test.h"
11
12#include <cstdint>
13#include <limits>
14#include <memory>
15
16DEF_TEST(SkSLTypeLimits, r) {
18
19 using int_limits = std::numeric_limits<int32_t>;
20 REPORTER_ASSERT(r, types.fInt->minimumValue() == int_limits::lowest());
21 REPORTER_ASSERT(r, types.fInt->maximumValue() == int_limits::max());
22
23 using short_limits = std::numeric_limits<int16_t>;
24 REPORTER_ASSERT(r, types.fShort->minimumValue() == short_limits::lowest());
25 REPORTER_ASSERT(r, types.fShort->maximumValue() == short_limits::max());
26
27 using uint_limits = std::numeric_limits<uint32_t>;
28 REPORTER_ASSERT(r, types.fUInt->minimumValue() == uint_limits::lowest());
29 REPORTER_ASSERT(r, types.fUInt->maximumValue() == uint_limits::max());
30
31 using ushort_limits = std::numeric_limits<uint16_t>;
32 REPORTER_ASSERT(r, types.fUShort->minimumValue() == ushort_limits::lowest());
33 REPORTER_ASSERT(r, types.fUShort->maximumValue() == ushort_limits::max());
34
35 using float_limits = std::numeric_limits<float>;
36 REPORTER_ASSERT(r, types.fFloat->minimumValue() == float_limits::lowest());
37 REPORTER_ASSERT(r, types.fFloat->maximumValue() == float_limits::max());
38}
DEF_TEST(SkSLTypeLimits, r)
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
const std::unique_ptr< Type > fUShort
const std::unique_ptr< Type > fInt
const std::unique_ptr< Type > fShort
const std::unique_ptr< Type > fUInt
const std::unique_ptr< Type > fFloat
static float max(float r, float g, float b)
Definition: hsl.cpp:49