Skip to content

Commit

Permalink
test/test_type_traits.cpp: Add a test for etl::type_identity (type_id…
Browse files Browse the repository at this point in the history
…entity_test_add(1.5f, 2) == 3.5f)
  • Loading branch information
tigran2008 committed Jun 10, 2024
1 parent 3805cb7 commit 8fc6084
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_type_traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ namespace
NotDefaultConstructible(NotDefaultConstructible&&) = delete;
NotDefaultConstructible& operator =(NotDefaultConstructible&) = delete;
};

// A function to test etl::type_identity.
template <typename T>
T type_identity_test_add(T first, typename etl::type_identity<T>::type second)
{
return first + second;
}
}

// Definitions for when the STL and compiler built-ins are not available.
Expand Down Expand Up @@ -1320,4 +1327,9 @@ namespace
CHECK_FALSE(bool(etl::is_base_of_all<Base, D1, D2, D3, D4>::value));
#endif
}

//*************************************************************************
TEST(test_type_identity) {
CHECK(type_identity_test_add(1.5f, 2) == 3.5f);
}
}

0 comments on commit 8fc6084

Please sign in to comment.