Rendering Engine 0.2.17
Modular Graphics Rendering Engine | v0.2.17
Loading...
Searching...
No Matches
model_material_tests.cpp File Reference
#include "model_material.hpp"
#include <gtest/gtest.h>
#include <stdexcept>

Go to the source code of this file.

Functions

 TEST (TextureTypeEnum, VisitsEntireInclusiveRangeExactlyOnceAndTerminates)
 
 TEST (TextureTypeEnum, PrefixAndPostfixHaveIteratorSemantics)
 
 TEST (TextureTypeEnum, EndDereferenceThrowsAndIncrementStaysAtEnd)
 

Function Documentation

◆ TEST() [1/3]

TEST ( TextureTypeEnum  ,
EndDereferenceThrowsAndIncrementStaysAtEnd   
)

Definition at line 43 of file model_material_tests.cpp.

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() [2/3]

TEST ( TextureTypeEnum  ,
PrefixAndPostfixHaveIteratorSemantics   
)

Definition at line 28 of file model_material_tests.cpp.

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}
TextureType
Enumerates supported texture map types for imported materials.

◆ TEST() [3/3]

TEST ( TextureTypeEnum  ,
VisitsEntireInclusiveRangeExactlyOnceAndTerminates   
)

Definition at line 12 of file model_material_tests.cpp.

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}