From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Tools/TestWebKitAPI/Test.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Tools/TestWebKitAPI/Test.h') diff --git a/Tools/TestWebKitAPI/Test.h b/Tools/TestWebKitAPI/Test.h index ca43924a2..cf44045fb 100644 --- a/Tools/TestWebKitAPI/Test.h +++ b/Tools/TestWebKitAPI/Test.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,8 @@ #ifndef Test_h #define Test_h +#include + namespace TestWebKitAPI { #define EXPECT_NOT_NULL(expression) \ @@ -40,6 +42,18 @@ namespace TestWebKitAPI { #define ASSERT_NULL(expression) \ ASSERT_TRUE(!(expression)) +template +static inline ::testing::AssertionResult assertStrongEnum(const char* expected_expression, const char* actual_expression, T expected, T actual) +{ + static_assert(std::is_enum::value, "T is not an enum type"); + typedef typename std::underlying_type::type UnderlyingStorageType; + return ::testing::internal::CmpHelperEQ(expected_expression, actual_expression, static_cast(expected), static_cast(actual)); +} + +#define EXPECT_STRONG_ENUM_EQ(expected, actual) \ + EXPECT_PRED_FORMAT2(TestWebKitAPI::assertStrongEnum, expected, actual) + + } // namespace TestWebKitAPI #endif // Test_h -- cgit v1.2.1