Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(129)

Unified Diff: include/gtest/gtest.h

Issue 157150: Issue 214 - Compile GTEST as a DLL Base URL: http://googletest.googlecode.com/svn/trunk/
Patch Set: Created 14 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « codegear/gtest.cbproj ('k') | include/gtest/gtest-message.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gtest/gtest.h
===================================================================
--- include/gtest/gtest.h (revision 343)
+++ include/gtest/gtest.h (working copy)
@@ -54,6 +54,7 @@
#include <limits>
#include <gtest/internal/gtest-internal.h>
#include <gtest/internal/gtest-string.h>
+#include <gtest/internal/gtest-dllexport.h>
#include <gtest/gtest-death-test.h>
#include <gtest/gtest-message.h>
#include <gtest/gtest-param-test.h>
@@ -254,7 +255,7 @@
// Expected: Foo() is even
// Actual: it's 5
//
-class AssertionResult {
+class GOOGLE_TEST_API AssertionResult {
public:
// Copy constructor.
// Used in EXPECT_TRUE/FALSE(assertion_result).
@@ -294,7 +295,18 @@
// construct is not satisfied with the predicate's outcome.
// Referenced via a pointer to avoid taking too much stack frame space
// with test assertions.
+
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4251) // Temporarily disables warning on
+ // DLL API mismatch.
+#endif
+
internal::scoped_ptr<internal::String> message_;
+
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
}; // class AssertionResult
// Streams a custom failure message into this object.
@@ -309,14 +321,14 @@
}
// Makes a successful assertion result.
-AssertionResult AssertionSuccess();
+GOOGLE_TEST_API AssertionResult AssertionSuccess();
// Makes a failed assertion result.
-AssertionResult AssertionFailure();
+GOOGLE_TEST_API AssertionResult AssertionFailure();
// Makes a failed assertion result with the given failure message.
// Deprecated; use AssertionFailure() << msg.
-AssertionResult AssertionFailure(const Message& msg);
+GOOGLE_TEST_API AssertionResult AssertionFailure(const Message& msg);
// The abstract class that all tests inherit from.
//
@@ -341,7 +353,7 @@
// TEST_F(FooTest, Baz) { ... }
//
// Test is not copyable.
-class Test {
+class GOOGLE_TEST_API Test {
public:
friend class internal::TestInfoImpl;
@@ -452,7 +464,7 @@
// output as a key/value string pair.
//
// Don't inherit from TestProperty as its destructor is not virtual.
-class TestProperty {
+class GOOGLE_TEST_API TestProperty {
public:
// C'tor. TestProperty does NOT have a default constructor.
// Always use this constructor (with parameters) to create a
@@ -489,7 +501,7 @@
// the Test.
//
// TestResult is not copyable.
-class TestResult {
+class GOOGLE_TEST_API TestResult {
public:
// Creates an empty TestResult.
TestResult();
@@ -583,10 +595,20 @@
// properties, whose values may be updated.
internal::Mutex test_properites_mutex_;
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4251) // Temporarily disables warning on
+ // DLL API mismatch.
+#endif
+
// The vector of TestPartResults
internal::scoped_ptr<internal::Vector<TestPartResult> > test_part_results_;
// The vector of TestProperties
internal::scoped_ptr<internal::Vector<TestProperty> > test_properties_;
+
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
// Running count of death tests.
int death_test_count_;
// The elapsed time, in milliseconds.
@@ -607,7 +629,7 @@
// The constructor of TestInfo registers itself with the UnitTest
// singleton such that the RUN_ALL_TESTS() macro knows which tests to
// run.
-class TestInfo {
+class GOOGLE_TEST_API TestInfo {
public:
// Destructs a TestInfo object. This function is not virtual, so
// don't inherit from TestInfo.
@@ -650,10 +672,10 @@
#if GTEST_HAS_DEATH_TEST
friend class internal::DefaultDeathTestFactory;
#endif // GTEST_HAS_DEATH_TEST
+ friend class internal::TestInfoImpl;
+ GOOGLE_TEST_API friend class internal::UnitTestImpl;
friend class Test;
friend class TestCase;
- friend class internal::TestInfoImpl;
- friend class internal::UnitTestImpl;
friend TestInfo* internal::MakeAndRegisterTestInfo(
const char* test_case_name, const char* name,
const char* test_case_comment, const char* comment,
@@ -689,7 +711,7 @@
// A test case, which consists of a vector of TestInfos.
//
// TestCase is not copyable.
-class TestCase {
+class GOOGLE_TEST_API TestCase {
public:
// Creates a TestCase with the given name.
//
@@ -801,6 +823,13 @@
internal::String name_;
// Comment on the test case.
internal::String comment_;
+
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4251) // Temporarily disables warning on
+ // DLL API mismatch.
+#endif
+
// The vector of TestInfos in their original order. It owns the
// elements in the vector.
const internal::scoped_ptr<internal::Vector<TestInfo*> > test_info_list_;
@@ -808,6 +837,11 @@
// shuffling and restoring the test order. The i-th element in this
// vector is the index of the i-th test in the shuffled test list.
const internal::scoped_ptr<internal::Vector<int> > test_indices_;
+
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
+
// Pointer to the function that sets up the test case.
Test::SetUpTestCaseFunc set_up_tc_;
// Pointer to the function that tears down the test case.
@@ -835,7 +869,7 @@
// available.
// 2. You cannot use ASSERT_* directly in a constructor or
// destructor.
-class Environment {
+class GOOGLE_TEST_API Environment {
public:
// The d'tor is virtual as we need to subclass Environment.
virtual ~Environment() {}
@@ -854,7 +888,7 @@
// The interface for tracing execution of tests. The methods are organized in
// the order the corresponding events are fired.
-class TestEventListener {
+class GOOGLE_TEST_API TestEventListener {
public:
virtual ~TestEventListener() {}
@@ -907,7 +941,7 @@
// the methods they override will not be caught during the build. For
// comments about each method please see the definition of TestEventListener
// above.
-class EmptyTestEventListener : public TestEventListener {
+class GOOGLE_TEST_API EmptyTestEventListener : public TestEventListener {
public:
virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
@@ -927,7 +961,7 @@
};
// TestEventListeners lets users add listeners to track events in Google Test.
-class TestEventListeners {
+class GOOGLE_TEST_API TestEventListeners {
public:
TestEventListeners();
~TestEventListeners();
@@ -1014,7 +1048,7 @@
//
// This class is thread-safe as long as the methods are called
// according to their specification.
-class UnitTest {
+class GOOGLE_TEST_API UnitTest {
public:
// Gets the singleton UnitTest object. The first time this method
// is called, a UnitTest object is constructed and returned.
@@ -1201,11 +1235,11 @@
// updated.
//
// Calling the function for the second time has no user-visible effect.
-void InitGoogleTest(int* argc, char** argv);
+void GOOGLE_TEST_API InitGoogleTest(int* argc, char** argv);
// This overloaded version can be used in Windows programs compiled in
// UNICODE mode.
-void InitGoogleTest(int* argc, wchar_t** argv);
+void GOOGLE_TEST_API InitGoogleTest(int* argc, wchar_t** argv);
namespace internal {
@@ -1283,7 +1317,7 @@
// With this overloaded version, we allow anonymous enums to be used
// in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
// can be implicitly cast to BiggestInt.
-AssertionResult CmpHelperEQ(const char* expected_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperEQ(const char* expected_expression,
const char* actual_expression,
BiggestInt expected,
BiggestInt actual);
@@ -1396,7 +1430,7 @@
// The helper function for {ASSERT|EXPECT}_STREQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTREQ(const char* expected_expression,
const char* actual_expression,
const char* expected,
const char* actual);
@@ -1404,7 +1438,7 @@
// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
const char* actual_expression,
const char* expected,
const char* actual);
@@ -1412,7 +1446,7 @@
// The helper function for {ASSERT|EXPECT}_STRNE.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTRNE(const char* s1_expression,
const char* s2_expression,
const char* s1,
const char* s2);
@@ -1420,7 +1454,7 @@
// The helper function for {ASSERT|EXPECT}_STRCASENE.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
const char* s2_expression,
const char* s1,
const char* s2);
@@ -1429,7 +1463,7 @@
// Helper function for *_STREQ on wide strings.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTREQ(const char* expected_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTREQ(const char* expected_expression,
const char* actual_expression,
const wchar_t* expected,
const wchar_t* actual);
@@ -1437,7 +1471,7 @@
// Helper function for *_STRNE on wide strings.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult CmpHelperSTRNE(const char* s1_expression,
+GOOGLE_TEST_API AssertionResult CmpHelperSTRNE(const char* s1_expression,
const char* s2_expression,
const wchar_t* s1,
const wchar_t* s2);
@@ -1452,32 +1486,32 @@
//
// The {needle,haystack}_expr arguments are the stringified
// expressions that generated the two real arguments.
-AssertionResult IsSubstring(
+GOOGLE_TEST_API AssertionResult IsSubstring(
const char* needle_expr, const char* haystack_expr,
const char* needle, const char* haystack);
-AssertionResult IsSubstring(
+GOOGLE_TEST_API AssertionResult IsSubstring(
const char* needle_expr, const char* haystack_expr,
const wchar_t* needle, const wchar_t* haystack);
-AssertionResult IsNotSubstring(
+GOOGLE_TEST_API AssertionResult IsNotSubstring(
const char* needle_expr, const char* haystack_expr,
const char* needle, const char* haystack);
-AssertionResult IsNotSubstring(
+GOOGLE_TEST_API AssertionResult IsNotSubstring(
const char* needle_expr, const char* haystack_expr,
const wchar_t* needle, const wchar_t* haystack);
#if GTEST_HAS_STD_STRING
-AssertionResult IsSubstring(
+GOOGLE_TEST_API AssertionResult IsSubstring(
const char* needle_expr, const char* haystack_expr,
const ::std::string& needle, const ::std::string& haystack);
-AssertionResult IsNotSubstring(
+GOOGLE_TEST_API AssertionResult IsNotSubstring(
const char* needle_expr, const char* haystack_expr,
const ::std::string& needle, const ::std::string& haystack);
#endif // GTEST_HAS_STD_STRING
#if GTEST_HAS_STD_WSTRING
-AssertionResult IsSubstring(
+GOOGLE_TEST_API AssertionResult IsSubstring(
const char* needle_expr, const char* haystack_expr,
const ::std::wstring& needle, const ::std::wstring& haystack);
-AssertionResult IsNotSubstring(
+GOOGLE_TEST_API AssertionResult IsNotSubstring(
const char* needle_expr, const char* haystack_expr,
const ::std::wstring& needle, const ::std::wstring& haystack);
#endif // GTEST_HAS_STD_WSTRING
@@ -1520,7 +1554,7 @@
// Helper function for implementing ASSERT_NEAR.
//
// INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
-AssertionResult DoubleNearPredFormat(const char* expr1,
+GOOGLE_TEST_API AssertionResult DoubleNearPredFormat(const char* expr1,
const char* expr2,
const char* abs_error_expr,
double val1,
@@ -1529,7 +1563,7 @@
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
// A class that enables one to stream messages to assertion macros
-class AssertHelper {
+class GOOGLE_TEST_API AssertHelper {
public:
// Constructor.
AssertHelper(TestPartResult::Type type,
@@ -1860,9 +1894,9 @@
// Asserts that val1 is less than, or almost equal to, val2. Fails
// otherwise. In particular, it fails if either val1 or val2 is NaN.
-AssertionResult FloatLE(const char* expr1, const char* expr2,
+GOOGLE_TEST_API AssertionResult FloatLE(const char* expr1, const char* expr2,
float val1, float val2);
-AssertionResult DoubleLE(const char* expr1, const char* expr2,
+GOOGLE_TEST_API AssertionResult DoubleLE(const char* expr1, const char* expr2,
double val1, double val2);
« no previous file with comments | « codegear/gtest.cbproj ('k') | include/gtest/gtest-message.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b