Rendering Engine 0.2.17
Modular Graphics Rendering Engine | v0.2.17
Loading...
Searching...
No Matches
model_material_tests.cpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2026 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6#include "model_material.hpp"
7#include <gtest/gtest.h>
8#include <stdexcept>
9
10using namespace rendering_engine;
11
12TEST(TextureTypeEnum, VisitsEntireInclusiveRangeExactlyOnceAndTerminates)
13{
14 const Enum<TextureType> range;
15 auto iterator = range.begin();
16 ASSERT_NE(iterator, range.end());
17 EXPECT_EQ(*iterator, TextureType::Begin);
18 // Bounded loop turns a broken termination condition into a failure, not a hang.
19 for (int value = TextureType::Begin; value <= TextureType::End; ++value)
20 {
21 ASSERT_NE(iterator, range.end());
22 EXPECT_EQ(*iterator, static_cast<TextureType>(value));
23 ++iterator;
24 }
25 EXPECT_EQ(iterator, range.end());
26}
27
28TEST(TextureTypeEnum, PrefixAndPostfixHaveIteratorSemantics)
29{
30 const Enum<TextureType> range;
31 auto iterator = range.begin();
32 auto copy = iterator;
33 EXPECT_EQ(copy, iterator);
34 EXPECT_EQ(&(++iterator), &iterator);
35 EXPECT_NE(copy, iterator);
36 EXPECT_EQ(*iterator, static_cast<TextureType>(static_cast<int>(TextureType::Begin) + 1));
37 auto previous = iterator++;
38 EXPECT_EQ(*previous, static_cast<TextureType>(static_cast<int>(TextureType::Begin) + 1));
39 EXPECT_EQ(*iterator, static_cast<TextureType>(static_cast<int>(TextureType::Begin) + 2));
40 EXPECT_EQ(*copy, TextureType::Begin);
41}
42
43TEST(TextureTypeEnum, EndDereferenceThrowsAndIncrementStaysAtEnd)
44{
45 const Enum<TextureType> range;
46 auto end = range.end();
47 EXPECT_THROW(*end, std::runtime_error);
48 ++end;
49 EXPECT_EQ(end, range.end());
50 EXPECT_EQ(end++, range.end());
51 EXPECT_EQ(end, range.end());
52 EXPECT_THROW(*end, std::runtime_error);
53}
TEST(TextureTypeEnum, VisitsEntireInclusiveRangeExactlyOnceAndTerminates)
TextureType
Enumerates supported texture map types for imported materials.