Man im so tired This is wrong but I can taste it, im close

This commit is contained in:
NaifBanana
2026-06-11 04:24:06 -05:00
parent fd7d36e4be
commit e23e062e58
8 changed files with 182 additions and 59 deletions
+33
View File
@@ -4,6 +4,7 @@
#include <gtest/gtest.h>
#include <string>
#include "TypeTraits.hpp"
#include "Utils.hpp"
namespace nb {
@@ -112,5 +113,37 @@ TEST(UtilsTest, TestStrToWstr) {
);
}
struct A { bool x(); };
struct B { bool y(); };
struct C { bool x(); bool y; };
struct D : C {};
template <typename T>
using has_x = decltype(T::x);
template <typename T>
using has_y = decltype(T::y);
TEST(UtilsTest, TestIsDetected) {
auto ret = is_detected<has_x, A>::value;
ASSERT_TRUE(ret);
ret = is_detected<has_y, A>::value;
ASSERT_FALSE(ret);
ret = is_detected<has_y, B>::value;
ASSERT_TRUE(ret);
ret = is_detected<has_x, B>::value;
ASSERT_FALSE(ret);
ret = is_detected<has_x, C>::value;
ASSERT_TRUE(ret);
ret = is_detected<has_y, C>::value;
ASSERT_TRUE(ret);
ret = is_detected<has_x, D>::value;
ASSERT_TRUE(ret);
ret = is_detected<has_y, D>::value;
ASSERT_TRUE(ret);
}
} // namespace nb