Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8CC7C200C3F for ; Wed, 8 Mar 2017 00:29:08 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8B320160B85; Tue, 7 Mar 2017 23:29:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4CB85160B8A for ; Wed, 8 Mar 2017 00:29:06 +0100 (CET) Received: (qmail 51759 invoked by uid 500); 7 Mar 2017 23:29:05 -0000 Mailing-List: contact commits-help@quickstep.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@quickstep.incubator.apache.org Delivered-To: mailing list commits@quickstep.incubator.apache.org Received: (qmail 51750 invoked by uid 99); 7 Mar 2017 23:29:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2017 23:29:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id EA0B11A091E for ; Tue, 7 Mar 2017 23:29:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.568 X-Spam-Level: X-Spam-Status: No, score=-3.568 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 8SRvfKrC7Ggs for ; Tue, 7 Mar 2017 23:28:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id BC01860D04 for ; Tue, 7 Mar 2017 23:28:35 +0000 (UTC) Received: (qmail 49061 invoked by uid 99); 7 Mar 2017 23:28:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2017 23:28:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B8EE2E980E; Tue, 7 Mar 2017 23:28:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zuyuz@apache.org To: commits@quickstep.incubator.apache.org Date: Tue, 07 Mar 2017 23:28:52 -0000 Message-Id: <6d99f5e87ad74fdd8beabc9b3c47638e@git.apache.org> In-Reply-To: <7e9d934211f9412cb9bbf34980351bdc@git.apache.org> References: <7e9d934211f9412cb9bbf34980351bdc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/48] incubator-quickstep git commit: Removed redundant third party libraries shared by both Quickstep and TMB. archived-at: Tue, 07 Mar 2017 23:29:08 -0000 http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample1_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample1_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample1_unittest.cc deleted file mode 100644 index aefc4f1..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample1_unittest.cc +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - - -// This sample shows how to write a simple unit test for a function, -// using Google C++ testing framework. -// -// Writing a unit test using Google C++ testing framework is easy as 1-2-3: - - -// Step 1. Include necessary header files such that the stuff your -// test logic needs is declared. -// -// Don't forget gtest.h, which declares the testing framework. - -#include -#include "sample1.h" -#include "gtest/gtest.h" - - -// Step 2. Use the TEST macro to define your tests. -// -// TEST has two parameters: the test case name and the test name. -// After using the macro, you should define your test logic between a -// pair of braces. You can use a bunch of macros to indicate the -// success or failure of a test. EXPECT_TRUE and EXPECT_EQ are -// examples of such macros. For a complete list, see gtest.h. -// -// -// -// In Google Test, tests are grouped into test cases. This is how we -// keep test code organized. You should put logically related tests -// into the same test case. -// -// The test case name and the test name should both be valid C++ -// identifiers. And you should not use underscore (_) in the names. -// -// Google Test guarantees that each test you define is run exactly -// once, but it makes no guarantee on the order the tests are -// executed. Therefore, you should write your tests in such a way -// that their results don't depend on their order. -// -// - - -// Tests Factorial(). - -// Tests factorial of negative numbers. -TEST(FactorialTest, Negative) { - // This test is named "Negative", and belongs to the "FactorialTest" - // test case. - EXPECT_EQ(1, Factorial(-5)); - EXPECT_EQ(1, Factorial(-1)); - EXPECT_GT(Factorial(-10), 0); - - // - // - // EXPECT_EQ(expected, actual) is the same as - // - // EXPECT_TRUE((expected) == (actual)) - // - // except that it will print both the expected value and the actual - // value when the assertion fails. This is very helpful for - // debugging. Therefore in this case EXPECT_EQ is preferred. - // - // On the other hand, EXPECT_TRUE accepts any Boolean expression, - // and is thus more general. - // - // -} - -// Tests factorial of 0. -TEST(FactorialTest, Zero) { - EXPECT_EQ(1, Factorial(0)); -} - -// Tests factorial of positive numbers. -TEST(FactorialTest, Positive) { - EXPECT_EQ(1, Factorial(1)); - EXPECT_EQ(2, Factorial(2)); - EXPECT_EQ(6, Factorial(3)); - EXPECT_EQ(40320, Factorial(8)); -} - - -// Tests IsPrime() - -// Tests negative input. -TEST(IsPrimeTest, Negative) { - // This test belongs to the IsPrimeTest test case. - - EXPECT_FALSE(IsPrime(-1)); - EXPECT_FALSE(IsPrime(-2)); - EXPECT_FALSE(IsPrime(INT_MIN)); -} - -// Tests some trivial cases. -TEST(IsPrimeTest, Trivial) { - EXPECT_FALSE(IsPrime(0)); - EXPECT_FALSE(IsPrime(1)); - EXPECT_TRUE(IsPrime(2)); - EXPECT_TRUE(IsPrime(3)); -} - -// Tests positive input. -TEST(IsPrimeTest, Positive) { - EXPECT_FALSE(IsPrime(4)); - EXPECT_TRUE(IsPrime(5)); - EXPECT_FALSE(IsPrime(6)); - EXPECT_TRUE(IsPrime(23)); -} - -// Step 3. Call RUN_ALL_TESTS() in main(). -// -// We do this by linking in src/gtest_main.cc file, which consists of -// a main() function which calls RUN_ALL_TESTS() for us. -// -// This runs all the tests you've defined, prints the result, and -// returns 0 if successful, or 1 otherwise. -// -// Did you notice that we didn't register the tests? The -// RUN_ALL_TESTS() macro magically knows about all the tests we -// defined. Isn't this convenient? http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample2.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample2.cc b/third_party/src/tmb/third_party/gtest/samples/sample2.cc deleted file mode 100644 index 5f763b9..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample2.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - -#include "sample2.h" - -#include - -// Clones a 0-terminated C string, allocating memory using new. -const char* MyString::CloneCString(const char* a_c_string) { - if (a_c_string == NULL) return NULL; - - const size_t len = strlen(a_c_string); - char* const clone = new char[ len + 1 ]; - memcpy(clone, a_c_string, len + 1); - - return clone; -} - -// Sets the 0-terminated C string this MyString object -// represents. -void MyString::Set(const char* a_c_string) { - // Makes sure this works when c_string == c_string_ - const char* const temp = MyString::CloneCString(a_c_string); - delete[] c_string_; - c_string_ = temp; -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample2.h ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample2.h b/third_party/src/tmb/third_party/gtest/samples/sample2.h deleted file mode 100644 index cb485c7..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample2.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - -#ifndef GTEST_SAMPLES_SAMPLE2_H_ -#define GTEST_SAMPLES_SAMPLE2_H_ - -#include - - -// A simple string class. -class MyString { - private: - const char* c_string_; - const MyString& operator=(const MyString& rhs); - - public: - // Clones a 0-terminated C string, allocating memory using new. - static const char* CloneCString(const char* a_c_string); - - //////////////////////////////////////////////////////////// - // - // C'tors - - // The default c'tor constructs a NULL string. - MyString() : c_string_(NULL) {} - - // Constructs a MyString by cloning a 0-terminated C string. - explicit MyString(const char* a_c_string) : c_string_(NULL) { - Set(a_c_string); - } - - // Copy c'tor - MyString(const MyString& string) : c_string_(NULL) { - Set(string.c_string_); - } - - //////////////////////////////////////////////////////////// - // - // D'tor. MyString is intended to be a final class, so the d'tor - // doesn't need to be virtual. - ~MyString() { delete[] c_string_; } - - // Gets the 0-terminated C string this MyString object represents. - const char* c_string() const { return c_string_; } - - size_t Length() const { - return c_string_ == NULL ? 0 : strlen(c_string_); - } - - // Sets the 0-terminated C string this MyString object represents. - void Set(const char* c_string); -}; - - -#endif // GTEST_SAMPLES_SAMPLE2_H_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample2_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample2_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample2_unittest.cc deleted file mode 100644 index 4fa19b7..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample2_unittest.cc +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - - -// This sample shows how to write a more complex unit test for a class -// that has multiple member functions. -// -// Usually, it's a good idea to have one test for each method in your -// class. You don't have to do that exactly, but it helps to keep -// your tests organized. You may also throw in additional tests as -// needed. - -#include "sample2.h" -#include "gtest/gtest.h" - -// In this example, we test the MyString class (a simple string). - -// Tests the default c'tor. -TEST(MyString, DefaultConstructor) { - const MyString s; - - // Asserts that s.c_string() returns NULL. - // - // - // - // If we write NULL instead of - // - // static_cast(NULL) - // - // in this assertion, it will generate a warning on gcc 3.4. The - // reason is that EXPECT_EQ needs to know the types of its - // arguments in order to print them when it fails. Since NULL is - // #defined as 0, the compiler will use the formatter function for - // int to print it. However, gcc thinks that NULL should be used as - // a pointer, not an int, and therefore complains. - // - // The root of the problem is C++'s lack of distinction between the - // integer number 0 and the null pointer constant. Unfortunately, - // we have to live with this fact. - // - // - EXPECT_STREQ(NULL, s.c_string()); - - EXPECT_EQ(0u, s.Length()); -} - -const char kHelloString[] = "Hello, world!"; - -// Tests the c'tor that accepts a C string. -TEST(MyString, ConstructorFromCString) { - const MyString s(kHelloString); - EXPECT_EQ(0, strcmp(s.c_string(), kHelloString)); - EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1, - s.Length()); -} - -// Tests the copy c'tor. -TEST(MyString, CopyConstructor) { - const MyString s1(kHelloString); - const MyString s2 = s1; - EXPECT_EQ(0, strcmp(s2.c_string(), kHelloString)); -} - -// Tests the Set method. -TEST(MyString, Set) { - MyString s; - - s.Set(kHelloString); - EXPECT_EQ(0, strcmp(s.c_string(), kHelloString)); - - // Set should work when the input pointer is the same as the one - // already in the MyString object. - s.Set(s.c_string()); - EXPECT_EQ(0, strcmp(s.c_string(), kHelloString)); - - // Can we set the MyString to NULL? - s.Set(NULL); - EXPECT_STREQ(NULL, s.c_string()); -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample3-inl.h ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample3-inl.h b/third_party/src/tmb/third_party/gtest/samples/sample3-inl.h deleted file mode 100644 index 7e3084d..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample3-inl.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - -#ifndef GTEST_SAMPLES_SAMPLE3_INL_H_ -#define GTEST_SAMPLES_SAMPLE3_INL_H_ - -#include - - -// Queue is a simple queue implemented as a singled-linked list. -// -// The element type must support copy constructor. -template // E is the element type -class Queue; - -// QueueNode is a node in a Queue, which consists of an element of -// type E and a pointer to the next node. -template // E is the element type -class QueueNode { - friend class Queue; - - public: - // Gets the element in this node. - const E& element() const { return element_; } - - // Gets the next node in the queue. - QueueNode* next() { return next_; } - const QueueNode* next() const { return next_; } - - private: - // Creates a node with a given element value. The next pointer is - // set to NULL. - explicit QueueNode(const E& an_element) : element_(an_element), next_(NULL) {} - - // We disable the default assignment operator and copy c'tor. - const QueueNode& operator = (const QueueNode&); - QueueNode(const QueueNode&); - - E element_; - QueueNode* next_; -}; - -template // E is the element type. -class Queue { - public: - // Creates an empty queue. - Queue() : head_(NULL), last_(NULL), size_(0) {} - - // D'tor. Clears the queue. - ~Queue() { Clear(); } - - // Clears the queue. - void Clear() { - if (size_ > 0) { - // 1. Deletes every node. - QueueNode* node = head_; - QueueNode* next = node->next(); - for (; ;) { - delete node; - node = next; - if (node == NULL) break; - next = node->next(); - } - - // 2. Resets the member variables. - head_ = last_ = NULL; - size_ = 0; - } - } - - // Gets the number of elements. - size_t Size() const { return size_; } - - // Gets the first element of the queue, or NULL if the queue is empty. - QueueNode* Head() { return head_; } - const QueueNode* Head() const { return head_; } - - // Gets the last element of the queue, or NULL if the queue is empty. - QueueNode* Last() { return last_; } - const QueueNode* Last() const { return last_; } - - // Adds an element to the end of the queue. A copy of the element is - // created using the copy constructor, and then stored in the queue. - // Changes made to the element in the queue doesn't affect the source - // object, and vice versa. - void Enqueue(const E& element) { - QueueNode* new_node = new QueueNode(element); - - if (size_ == 0) { - head_ = last_ = new_node; - size_ = 1; - } else { - last_->next_ = new_node; - last_ = new_node; - size_++; - } - } - - // Removes the head of the queue and returns it. Returns NULL if - // the queue is empty. - E* Dequeue() { - if (size_ == 0) { - return NULL; - } - - const QueueNode* const old_head = head_; - head_ = head_->next_; - size_--; - if (size_ == 0) { - last_ = NULL; - } - - E* element = new E(old_head->element()); - delete old_head; - - return element; - } - - // Applies a function/functor on each element of the queue, and - // returns the result in a new queue. The original queue is not - // affected. - template - Queue* Map(F function) const { - Queue* new_queue = new Queue(); - for (const QueueNode* node = head_; node != NULL; node = node->next_) { - new_queue->Enqueue(function(node->element())); - } - - return new_queue; - } - - private: - QueueNode* head_; // The first node of the queue. - QueueNode* last_; // The last node of the queue. - size_t size_; // The number of elements in the queue. - - // We disallow copying a queue. - Queue(const Queue&); - const Queue& operator = (const Queue&); -}; - -#endif // GTEST_SAMPLES_SAMPLE3_INL_H_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample3_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample3_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample3_unittest.cc deleted file mode 100644 index bf3877d..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample3_unittest.cc +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - - -// In this example, we use a more advanced feature of Google Test called -// test fixture. -// -// A test fixture is a place to hold objects and functions shared by -// all tests in a test case. Using a test fixture avoids duplicating -// the test code necessary to initialize and cleanup those common -// objects for each test. It is also useful for defining sub-routines -// that your tests need to invoke a lot. -// -// -// -// The tests share the test fixture in the sense of code sharing, not -// data sharing. Each test is given its own fresh copy of the -// fixture. You cannot expect the data modified by one test to be -// passed on to another test, which is a bad idea. -// -// The reason for this design is that tests should be independent and -// repeatable. In particular, a test should not fail as the result of -// another test's failure. If one test depends on info produced by -// another test, then the two tests should really be one big test. -// -// The macros for indicating the success/failure of a test -// (EXPECT_TRUE, FAIL, etc) need to know what the current test is -// (when Google Test prints the test result, it tells you which test -// each failure belongs to). Technically, these macros invoke a -// member function of the Test class. Therefore, you cannot use them -// in a global function. That's why you should put test sub-routines -// in a test fixture. -// -// - -#include "sample3-inl.h" -#include "gtest/gtest.h" - -// To use a test fixture, derive a class from testing::Test. -class QueueTest : public testing::Test { - protected: // You should make the members protected s.t. they can be - // accessed from sub-classes. - - // virtual void SetUp() will be called before each test is run. You - // should define it if you need to initialize the varaibles. - // Otherwise, this can be skipped. - virtual void SetUp() { - q1_.Enqueue(1); - q2_.Enqueue(2); - q2_.Enqueue(3); - } - - // virtual void TearDown() will be called after each test is run. - // You should define it if there is cleanup work to do. Otherwise, - // you don't have to provide it. - // - // virtual void TearDown() { - // } - - // A helper function that some test uses. - static int Double(int n) { - return 2*n; - } - - // A helper function for testing Queue::Map(). - void MapTester(const Queue * q) { - // Creates a new queue, where each element is twice as big as the - // corresponding one in q. - const Queue * const new_q = q->Map(Double); - - // Verifies that the new queue has the same size as q. - ASSERT_EQ(q->Size(), new_q->Size()); - - // Verifies the relationship between the elements of the two queues. - for ( const QueueNode * n1 = q->Head(), * n2 = new_q->Head(); - n1 != NULL; n1 = n1->next(), n2 = n2->next() ) { - EXPECT_EQ(2 * n1->element(), n2->element()); - } - - delete new_q; - } - - // Declares the variables your tests want to use. - Queue q0_; - Queue q1_; - Queue q2_; -}; - -// When you have a test fixture, you define a test using TEST_F -// instead of TEST. - -// Tests the default c'tor. -TEST_F(QueueTest, DefaultConstructor) { - // You can access data in the test fixture here. - EXPECT_EQ(0u, q0_.Size()); -} - -// Tests Dequeue(). -TEST_F(QueueTest, Dequeue) { - int * n = q0_.Dequeue(); - EXPECT_TRUE(n == NULL); - - n = q1_.Dequeue(); - ASSERT_TRUE(n != NULL); - EXPECT_EQ(1, *n); - EXPECT_EQ(0u, q1_.Size()); - delete n; - - n = q2_.Dequeue(); - ASSERT_TRUE(n != NULL); - EXPECT_EQ(2, *n); - EXPECT_EQ(1u, q2_.Size()); - delete n; -} - -// Tests the Queue::Map() function. -TEST_F(QueueTest, Map) { - MapTester(&q0_); - MapTester(&q1_); - MapTester(&q2_); -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample4.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample4.cc b/third_party/src/tmb/third_party/gtest/samples/sample4.cc deleted file mode 100644 index ae44bda..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample4.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - -#include - -#include "sample4.h" - -// Returns the current counter value, and increments it. -int Counter::Increment() { - return counter_++; -} - -// Prints the current counter value to STDOUT. -void Counter::Print() const { - printf("%d", counter_); -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample4.h ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample4.h b/third_party/src/tmb/third_party/gtest/samples/sample4.h deleted file mode 100644 index cd60f0d..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample4.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A sample program demonstrating using Google C++ testing framework. -// -// Author: wan@google.com (Zhanyong Wan) - -#ifndef GTEST_SAMPLES_SAMPLE4_H_ -#define GTEST_SAMPLES_SAMPLE4_H_ - -// A simple monotonic counter. -class Counter { - private: - int counter_; - - public: - // Creates a counter that starts at 0. - Counter() : counter_(0) {} - - // Returns the current counter value, and increments it. - int Increment(); - - // Prints the current counter value to STDOUT. - void Print() const; -}; - -#endif // GTEST_SAMPLES_SAMPLE4_H_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample4_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample4_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample4_unittest.cc deleted file mode 100644 index fa5afc7..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample4_unittest.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -#include "gtest/gtest.h" -#include "sample4.h" - -// Tests the Increment() method. -TEST(Counter, Increment) { - Counter c; - - // EXPECT_EQ() evaluates its arguments exactly once, so they - // can have side effects. - - EXPECT_EQ(0, c.Increment()); - EXPECT_EQ(1, c.Increment()); - EXPECT_EQ(2, c.Increment()); -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample5_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample5_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample5_unittest.cc deleted file mode 100644 index 43d8e57..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample5_unittest.cc +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2005, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// This sample teaches how to reuse a test fixture in multiple test -// cases by deriving sub-fixtures from it. -// -// When you define a test fixture, you specify the name of the test -// case that will use this fixture. Therefore, a test fixture can -// be used by only one test case. -// -// Sometimes, more than one test cases may want to use the same or -// slightly different test fixtures. For example, you may want to -// make sure that all tests for a GUI library don't leak important -// system resources like fonts and brushes. In Google Test, you do -// this by putting the shared logic in a super (as in "super class") -// test fixture, and then have each test case use a fixture derived -// from this super fixture. - -#include -#include -#include "sample3-inl.h" -#include "gtest/gtest.h" -#include "sample1.h" - -// In this sample, we want to ensure that every test finishes within -// ~5 seconds. If a test takes longer to run, we consider it a -// failure. -// -// We put the code for timing a test in a test fixture called -// "QuickTest". QuickTest is intended to be the super fixture that -// other fixtures derive from, therefore there is no test case with -// the name "QuickTest". This is OK. -// -// Later, we will derive multiple test fixtures from QuickTest. -class QuickTest : public testing::Test { - protected: - // Remember that SetUp() is run immediately before a test starts. - // This is a good place to record the start time. - virtual void SetUp() { - start_time_ = time(NULL); - } - - // TearDown() is invoked immediately after a test finishes. Here we - // check if the test was too slow. - virtual void TearDown() { - // Gets the time when the test finishes - const time_t end_time = time(NULL); - - // Asserts that the test took no more than ~5 seconds. Did you - // know that you can use assertions in SetUp() and TearDown() as - // well? - EXPECT_TRUE(end_time - start_time_ <= 5) << "The test took too long."; - } - - // The UTC time (in seconds) when the test starts - time_t start_time_; -}; - - -// We derive a fixture named IntegerFunctionTest from the QuickTest -// fixture. All tests using this fixture will be automatically -// required to be quick. -class IntegerFunctionTest : public QuickTest { - // We don't need any more logic than already in the QuickTest fixture. - // Therefore the body is empty. -}; - - -// Now we can write tests in the IntegerFunctionTest test case. - -// Tests Factorial() -TEST_F(IntegerFunctionTest, Factorial) { - // Tests factorial of negative numbers. - EXPECT_EQ(1, Factorial(-5)); - EXPECT_EQ(1, Factorial(-1)); - EXPECT_GT(Factorial(-10), 0); - - // Tests factorial of 0. - EXPECT_EQ(1, Factorial(0)); - - // Tests factorial of positive numbers. - EXPECT_EQ(1, Factorial(1)); - EXPECT_EQ(2, Factorial(2)); - EXPECT_EQ(6, Factorial(3)); - EXPECT_EQ(40320, Factorial(8)); -} - - -// Tests IsPrime() -TEST_F(IntegerFunctionTest, IsPrime) { - // Tests negative input. - EXPECT_FALSE(IsPrime(-1)); - EXPECT_FALSE(IsPrime(-2)); - EXPECT_FALSE(IsPrime(INT_MIN)); - - // Tests some trivial cases. - EXPECT_FALSE(IsPrime(0)); - EXPECT_FALSE(IsPrime(1)); - EXPECT_TRUE(IsPrime(2)); - EXPECT_TRUE(IsPrime(3)); - - // Tests positive input. - EXPECT_FALSE(IsPrime(4)); - EXPECT_TRUE(IsPrime(5)); - EXPECT_FALSE(IsPrime(6)); - EXPECT_TRUE(IsPrime(23)); -} - - -// The next test case (named "QueueTest") also needs to be quick, so -// we derive another fixture from QuickTest. -// -// The QueueTest test fixture has some logic and shared objects in -// addition to what's in QuickTest already. We define the additional -// stuff inside the body of the test fixture, as usual. -class QueueTest : public QuickTest { - protected: - virtual void SetUp() { - // First, we need to set up the super fixture (QuickTest). - QuickTest::SetUp(); - - // Second, some additional setup for this fixture. - q1_.Enqueue(1); - q2_.Enqueue(2); - q2_.Enqueue(3); - } - - // By default, TearDown() inherits the behavior of - // QuickTest::TearDown(). As we have no additional cleaning work - // for QueueTest, we omit it here. - // - // virtual void TearDown() { - // QuickTest::TearDown(); - // } - - Queue q0_; - Queue q1_; - Queue q2_; -}; - - -// Now, let's write tests using the QueueTest fixture. - -// Tests the default constructor. -TEST_F(QueueTest, DefaultConstructor) { - EXPECT_EQ(0u, q0_.Size()); -} - -// Tests Dequeue(). -TEST_F(QueueTest, Dequeue) { - int* n = q0_.Dequeue(); - EXPECT_TRUE(n == NULL); - - n = q1_.Dequeue(); - EXPECT_TRUE(n != NULL); - EXPECT_EQ(1, *n); - EXPECT_EQ(0u, q1_.Size()); - delete n; - - n = q2_.Dequeue(); - EXPECT_TRUE(n != NULL); - EXPECT_EQ(2, *n); - EXPECT_EQ(1u, q2_.Size()); - delete n; -} - -// If necessary, you can derive further test fixtures from a derived -// fixture itself. For example, you can derive another fixture from -// QueueTest. Google Test imposes no limit on how deep the hierarchy -// can be. In practice, however, you probably don't want it to be too -// deep as to be confusing. http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample6_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample6_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample6_unittest.cc deleted file mode 100644 index 8f2036a..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample6_unittest.cc +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) - -// This sample shows how to test common properties of multiple -// implementations of the same interface (aka interface tests). - -// The interface and its implementations are in this header. -#include "prime_tables.h" - -#include "gtest/gtest.h" - -// First, we define some factory functions for creating instances of -// the implementations. You may be able to skip this step if all your -// implementations can be constructed the same way. - -template -PrimeTable* CreatePrimeTable(); - -template <> -PrimeTable* CreatePrimeTable() { - return new OnTheFlyPrimeTable; -} - -template <> -PrimeTable* CreatePrimeTable() { - return new PreCalculatedPrimeTable(10000); -} - -// Then we define a test fixture class template. -template -class PrimeTableTest : public testing::Test { - protected: - // The ctor calls the factory function to create a prime table - // implemented by T. - PrimeTableTest() : table_(CreatePrimeTable()) {} - - virtual ~PrimeTableTest() { delete table_; } - - // Note that we test an implementation via the base interface - // instead of the actual implementation class. This is important - // for keeping the tests close to the real world scenario, where the - // implementation is invoked via the base interface. It avoids - // got-yas where the implementation class has a method that shadows - // a method with the same name (but slightly different argument - // types) in the base interface, for example. - PrimeTable* const table_; -}; - -#if GTEST_HAS_TYPED_TEST - -using testing::Types; - -// Google Test offers two ways for reusing tests for different types. -// The first is called "typed tests". You should use it if you -// already know *all* the types you are gonna exercise when you write -// the tests. - -// To write a typed test case, first use -// -// TYPED_TEST_CASE(TestCaseName, TypeList); -// -// to declare it and specify the type parameters. As with TEST_F, -// TestCaseName must match the test fixture name. - -// The list of types we want to test. -typedef Types Implementations; - -TYPED_TEST_CASE(PrimeTableTest, Implementations); - -// Then use TYPED_TEST(TestCaseName, TestName) to define a typed test, -// similar to TEST_F. -TYPED_TEST(PrimeTableTest, ReturnsFalseForNonPrimes) { - // Inside the test body, you can refer to the type parameter by - // TypeParam, and refer to the fixture class by TestFixture. We - // don't need them in this example. - - // Since we are in the template world, C++ requires explicitly - // writing 'this->' when referring to members of the fixture class. - // This is something you have to learn to live with. - EXPECT_FALSE(this->table_->IsPrime(-5)); - EXPECT_FALSE(this->table_->IsPrime(0)); - EXPECT_FALSE(this->table_->IsPrime(1)); - EXPECT_FALSE(this->table_->IsPrime(4)); - EXPECT_FALSE(this->table_->IsPrime(6)); - EXPECT_FALSE(this->table_->IsPrime(100)); -} - -TYPED_TEST(PrimeTableTest, ReturnsTrueForPrimes) { - EXPECT_TRUE(this->table_->IsPrime(2)); - EXPECT_TRUE(this->table_->IsPrime(3)); - EXPECT_TRUE(this->table_->IsPrime(5)); - EXPECT_TRUE(this->table_->IsPrime(7)); - EXPECT_TRUE(this->table_->IsPrime(11)); - EXPECT_TRUE(this->table_->IsPrime(131)); -} - -TYPED_TEST(PrimeTableTest, CanGetNextPrime) { - EXPECT_EQ(2, this->table_->GetNextPrime(0)); - EXPECT_EQ(3, this->table_->GetNextPrime(2)); - EXPECT_EQ(5, this->table_->GetNextPrime(3)); - EXPECT_EQ(7, this->table_->GetNextPrime(5)); - EXPECT_EQ(11, this->table_->GetNextPrime(7)); - EXPECT_EQ(131, this->table_->GetNextPrime(128)); -} - -// That's it! Google Test will repeat each TYPED_TEST for each type -// in the type list specified in TYPED_TEST_CASE. Sit back and be -// happy that you don't have to define them multiple times. - -#endif // GTEST_HAS_TYPED_TEST - -#if GTEST_HAS_TYPED_TEST_P - -using testing::Types; - -// Sometimes, however, you don't yet know all the types that you want -// to test when you write the tests. For example, if you are the -// author of an interface and expect other people to implement it, you -// might want to write a set of tests to make sure each implementation -// conforms to some basic requirements, but you don't know what -// implementations will be written in the future. -// -// How can you write the tests without committing to the type -// parameters? That's what "type-parameterized tests" can do for you. -// It is a bit more involved than typed tests, but in return you get a -// test pattern that can be reused in many contexts, which is a big -// win. Here's how you do it: - -// First, define a test fixture class template. Here we just reuse -// the PrimeTableTest fixture defined earlier: - -template -class PrimeTableTest2 : public PrimeTableTest { -}; - -// Then, declare the test case. The argument is the name of the test -// fixture, and also the name of the test case (as usual). The _P -// suffix is for "parameterized" or "pattern". -TYPED_TEST_CASE_P(PrimeTableTest2); - -// Next, use TYPED_TEST_P(TestCaseName, TestName) to define a test, -// similar to what you do with TEST_F. -TYPED_TEST_P(PrimeTableTest2, ReturnsFalseForNonPrimes) { - EXPECT_FALSE(this->table_->IsPrime(-5)); - EXPECT_FALSE(this->table_->IsPrime(0)); - EXPECT_FALSE(this->table_->IsPrime(1)); - EXPECT_FALSE(this->table_->IsPrime(4)); - EXPECT_FALSE(this->table_->IsPrime(6)); - EXPECT_FALSE(this->table_->IsPrime(100)); -} - -TYPED_TEST_P(PrimeTableTest2, ReturnsTrueForPrimes) { - EXPECT_TRUE(this->table_->IsPrime(2)); - EXPECT_TRUE(this->table_->IsPrime(3)); - EXPECT_TRUE(this->table_->IsPrime(5)); - EXPECT_TRUE(this->table_->IsPrime(7)); - EXPECT_TRUE(this->table_->IsPrime(11)); - EXPECT_TRUE(this->table_->IsPrime(131)); -} - -TYPED_TEST_P(PrimeTableTest2, CanGetNextPrime) { - EXPECT_EQ(2, this->table_->GetNextPrime(0)); - EXPECT_EQ(3, this->table_->GetNextPrime(2)); - EXPECT_EQ(5, this->table_->GetNextPrime(3)); - EXPECT_EQ(7, this->table_->GetNextPrime(5)); - EXPECT_EQ(11, this->table_->GetNextPrime(7)); - EXPECT_EQ(131, this->table_->GetNextPrime(128)); -} - -// Type-parameterized tests involve one extra step: you have to -// enumerate the tests you defined: -REGISTER_TYPED_TEST_CASE_P( - PrimeTableTest2, // The first argument is the test case name. - // The rest of the arguments are the test names. - ReturnsFalseForNonPrimes, ReturnsTrueForPrimes, CanGetNextPrime); - -// At this point the test pattern is done. However, you don't have -// any real test yet as you haven't said which types you want to run -// the tests with. - -// To turn the abstract test pattern into real tests, you instantiate -// it with a list of types. Usually the test pattern will be defined -// in a .h file, and anyone can #include and instantiate it. You can -// even instantiate it more than once in the same program. To tell -// different instances apart, you give each of them a name, which will -// become part of the test case name and can be used in test filters. - -// The list of types we want to test. Note that it doesn't have to be -// defined at the time we write the TYPED_TEST_P()s. -typedef Types - PrimeTableImplementations; -INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name - PrimeTableTest2, // Test case name - PrimeTableImplementations); // Type list - -#endif // GTEST_HAS_TYPED_TEST_P http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample7_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample7_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample7_unittest.cc deleted file mode 100644 index 1b651a2..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample7_unittest.cc +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: vladl@google.com (Vlad Losev) - -// This sample shows how to test common properties of multiple -// implementations of an interface (aka interface tests) using -// value-parameterized tests. Each test in the test case has -// a parameter that is an interface pointer to an implementation -// tested. - -// The interface and its implementations are in this header. -#include "prime_tables.h" - -#include "gtest/gtest.h" - -#if GTEST_HAS_PARAM_TEST - -using ::testing::TestWithParam; -using ::testing::Values; - -// As a general rule, to prevent a test from affecting the tests that come -// after it, you should create and destroy the tested objects for each test -// instead of reusing them. In this sample we will define a simple factory -// function for PrimeTable objects. We will instantiate objects in test's -// SetUp() method and delete them in TearDown() method. -typedef PrimeTable* CreatePrimeTableFunc(); - -PrimeTable* CreateOnTheFlyPrimeTable() { - return new OnTheFlyPrimeTable(); -} - -template -PrimeTable* CreatePreCalculatedPrimeTable() { - return new PreCalculatedPrimeTable(max_precalculated); -} - -// Inside the test body, fixture constructor, SetUp(), and TearDown() you -// can refer to the test parameter by GetParam(). In this case, the test -// parameter is a factory function which we call in fixture's SetUp() to -// create and store an instance of PrimeTable. -class PrimeTableTest : public TestWithParam { - public: - virtual ~PrimeTableTest() { delete table_; } - virtual void SetUp() { table_ = (*GetParam())(); } - virtual void TearDown() { - delete table_; - table_ = NULL; - } - - protected: - PrimeTable* table_; -}; - -TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { - EXPECT_FALSE(table_->IsPrime(-5)); - EXPECT_FALSE(table_->IsPrime(0)); - EXPECT_FALSE(table_->IsPrime(1)); - EXPECT_FALSE(table_->IsPrime(4)); - EXPECT_FALSE(table_->IsPrime(6)); - EXPECT_FALSE(table_->IsPrime(100)); -} - -TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { - EXPECT_TRUE(table_->IsPrime(2)); - EXPECT_TRUE(table_->IsPrime(3)); - EXPECT_TRUE(table_->IsPrime(5)); - EXPECT_TRUE(table_->IsPrime(7)); - EXPECT_TRUE(table_->IsPrime(11)); - EXPECT_TRUE(table_->IsPrime(131)); -} - -TEST_P(PrimeTableTest, CanGetNextPrime) { - EXPECT_EQ(2, table_->GetNextPrime(0)); - EXPECT_EQ(3, table_->GetNextPrime(2)); - EXPECT_EQ(5, table_->GetNextPrime(3)); - EXPECT_EQ(7, table_->GetNextPrime(5)); - EXPECT_EQ(11, table_->GetNextPrime(7)); - EXPECT_EQ(131, table_->GetNextPrime(128)); -} - -// In order to run value-parameterized tests, you need to instantiate them, -// or bind them to a list of values which will be used as test parameters. -// You can instantiate them in a different translation module, or even -// instantiate them several times. -// -// Here, we instantiate our tests with a list of two PrimeTable object -// factory functions: -INSTANTIATE_TEST_CASE_P( - OnTheFlyAndPreCalculated, - PrimeTableTest, - Values(&CreateOnTheFlyPrimeTable, &CreatePreCalculatedPrimeTable<1000>)); - -#else - -// Google Test may not support value-parameterized tests with some -// compilers. If we use conditional compilation to compile out all -// code referring to the gtest_main library, MSVC linker will not link -// that library at all and consequently complain about missing entry -// point defined in that library (fatal error LNK1561: entry point -// must be defined). This dummy test keeps gtest_main linked in. -TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} - -#endif // GTEST_HAS_PARAM_TEST http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample8_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample8_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample8_unittest.cc deleted file mode 100644 index 5ad2e2c..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample8_unittest.cc +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: vladl@google.com (Vlad Losev) - -// This sample shows how to test code relying on some global flag variables. -// Combine() helps with generating all possible combinations of such flags, -// and each test is given one combination as a parameter. - -// Use class definitions to test from this header. -#include "prime_tables.h" - -#include "gtest/gtest.h" - -#if GTEST_HAS_COMBINE - -// Suppose we want to introduce a new, improved implementation of PrimeTable -// which combines speed of PrecalcPrimeTable and versatility of -// OnTheFlyPrimeTable (see prime_tables.h). Inside it instantiates both -// PrecalcPrimeTable and OnTheFlyPrimeTable and uses the one that is more -// appropriate under the circumstances. But in low memory conditions, it can be -// told to instantiate without PrecalcPrimeTable instance at all and use only -// OnTheFlyPrimeTable. -class HybridPrimeTable : public PrimeTable { - public: - HybridPrimeTable(bool force_on_the_fly, int max_precalculated) - : on_the_fly_impl_(new OnTheFlyPrimeTable), - precalc_impl_(force_on_the_fly ? NULL : - new PreCalculatedPrimeTable(max_precalculated)), - max_precalculated_(max_precalculated) {} - virtual ~HybridPrimeTable() { - delete on_the_fly_impl_; - delete precalc_impl_; - } - - virtual bool IsPrime(int n) const { - if (precalc_impl_ != NULL && n < max_precalculated_) - return precalc_impl_->IsPrime(n); - else - return on_the_fly_impl_->IsPrime(n); - } - - virtual int GetNextPrime(int p) const { - int next_prime = -1; - if (precalc_impl_ != NULL && p < max_precalculated_) - next_prime = precalc_impl_->GetNextPrime(p); - - return next_prime != -1 ? next_prime : on_the_fly_impl_->GetNextPrime(p); - } - - private: - OnTheFlyPrimeTable* on_the_fly_impl_; - PreCalculatedPrimeTable* precalc_impl_; - int max_precalculated_; -}; - -using ::testing::TestWithParam; -using ::testing::Bool; -using ::testing::Values; -using ::testing::Combine; - -// To test all code paths for HybridPrimeTable we must test it with numbers -// both within and outside PreCalculatedPrimeTable's capacity and also with -// PreCalculatedPrimeTable disabled. We do this by defining fixture which will -// accept different combinations of parameters for instantiating a -// HybridPrimeTable instance. -class PrimeTableTest : public TestWithParam< ::std::tr1::tuple > { - protected: - virtual void SetUp() { - // This can be written as - // - // bool force_on_the_fly; - // int max_precalculated; - // tie(force_on_the_fly, max_precalculated) = GetParam(); - // - // once the Google C++ Style Guide allows use of ::std::tr1::tie. - // - bool force_on_the_fly = ::std::tr1::get<0>(GetParam()); - int max_precalculated = ::std::tr1::get<1>(GetParam()); - table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated); - } - virtual void TearDown() { - delete table_; - table_ = NULL; - } - HybridPrimeTable* table_; -}; - -TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { - // Inside the test body, you can refer to the test parameter by GetParam(). - // In this case, the test parameter is a PrimeTable interface pointer which - // we can use directly. - // Please note that you can also save it in the fixture's SetUp() method - // or constructor and use saved copy in the tests. - - EXPECT_FALSE(table_->IsPrime(-5)); - EXPECT_FALSE(table_->IsPrime(0)); - EXPECT_FALSE(table_->IsPrime(1)); - EXPECT_FALSE(table_->IsPrime(4)); - EXPECT_FALSE(table_->IsPrime(6)); - EXPECT_FALSE(table_->IsPrime(100)); -} - -TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { - EXPECT_TRUE(table_->IsPrime(2)); - EXPECT_TRUE(table_->IsPrime(3)); - EXPECT_TRUE(table_->IsPrime(5)); - EXPECT_TRUE(table_->IsPrime(7)); - EXPECT_TRUE(table_->IsPrime(11)); - EXPECT_TRUE(table_->IsPrime(131)); -} - -TEST_P(PrimeTableTest, CanGetNextPrime) { - EXPECT_EQ(2, table_->GetNextPrime(0)); - EXPECT_EQ(3, table_->GetNextPrime(2)); - EXPECT_EQ(5, table_->GetNextPrime(3)); - EXPECT_EQ(7, table_->GetNextPrime(5)); - EXPECT_EQ(11, table_->GetNextPrime(7)); - EXPECT_EQ(131, table_->GetNextPrime(128)); -} - -// In order to run value-parameterized tests, you need to instantiate them, -// or bind them to a list of values which will be used as test parameters. -// You can instantiate them in a different translation module, or even -// instantiate them several times. -// -// Here, we instantiate our tests with a list of parameters. We must combine -// all variations of the boolean flag suppressing PrecalcPrimeTable and some -// meaningful values for tests. We choose a small value (1), and a value that -// will put some of the tested numbers beyond the capability of the -// PrecalcPrimeTable instance and some inside it (10). Combine will produce all -// possible combinations. -INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, - PrimeTableTest, - Combine(Bool(), Values(1, 10))); - -#else - -// Google Test may not support Combine() with some compilers. If we -// use conditional compilation to compile out all code referring to -// the gtest_main library, MSVC linker will not link that library at -// all and consequently complain about missing entry point defined in -// that library (fatal error LNK1561: entry point must be -// defined). This dummy test keeps gtest_main linked in. -TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} - -#endif // GTEST_HAS_COMBINE http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/samples/sample9_unittest.cc ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/samples/sample9_unittest.cc b/third_party/src/tmb/third_party/gtest/samples/sample9_unittest.cc deleted file mode 100644 index b2e2079..0000000 --- a/third_party/src/tmb/third_party/gtest/samples/sample9_unittest.cc +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2009 Google Inc. All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: vladl@google.com (Vlad Losev) - -// This sample shows how to use Google Test listener API to implement -// an alternative console output and how to use the UnitTest reflection API -// to enumerate test cases and tests and to inspect their results. - -#include - -#include "gtest/gtest.h" - -using ::testing::EmptyTestEventListener; -using ::testing::InitGoogleTest; -using ::testing::Test; -using ::testing::TestCase; -using ::testing::TestEventListeners; -using ::testing::TestInfo; -using ::testing::TestPartResult; -using ::testing::UnitTest; - -namespace { - -// Provides alternative output mode which produces minimal amount of -// information about tests. -class TersePrinter : public EmptyTestEventListener { - private: - // Called before any test activity starts. - virtual void OnTestProgramStart(const UnitTest& /* unit_test */) {} - - // Called after all test activities have ended. - virtual void OnTestProgramEnd(const UnitTest& unit_test) { - fprintf(stdout, "TEST %s\n", unit_test.Passed() ? "PASSED" : "FAILED"); - fflush(stdout); - } - - // Called before a test starts. - virtual void OnTestStart(const TestInfo& test_info) { - fprintf(stdout, - "*** Test %s.%s starting.\n", - test_info.test_case_name(), - test_info.name()); - fflush(stdout); - } - - // Called after a failed assertion or a SUCCEED() invocation. - virtual void OnTestPartResult(const TestPartResult& test_part_result) { - fprintf(stdout, - "%s in %s:%d\n%s\n", - test_part_result.failed() ? "*** Failure" : "Success", - test_part_result.file_name(), - test_part_result.line_number(), - test_part_result.summary()); - fflush(stdout); - } - - // Called after a test ends. - virtual void OnTestEnd(const TestInfo& test_info) { - fprintf(stdout, - "*** Test %s.%s ending.\n", - test_info.test_case_name(), - test_info.name()); - fflush(stdout); - } -}; // class TersePrinter - -TEST(CustomOutputTest, PrintsMessage) { - printf("Printing something from the test body...\n"); -} - -TEST(CustomOutputTest, Succeeds) { - SUCCEED() << "SUCCEED() has been invoked from here"; -} - -TEST(CustomOutputTest, Fails) { - EXPECT_EQ(1, 2) - << "This test fails in order to demonstrate alternative failure messages"; -} - -} // namespace - -int main(int argc, char **argv) { - InitGoogleTest(&argc, argv); - - bool terse_output = false; - if (argc > 1 && strcmp(argv[1], "--terse_output") == 0 ) - terse_output = true; - else - printf("%s\n", "Run this program with --terse_output to change the way " - "it prints its output."); - - UnitTest& unit_test = *UnitTest::GetInstance(); - - // If we are given the --terse_output command line flag, suppresses the - // standard output and attaches own result printer. - if (terse_output) { - TestEventListeners& listeners = unit_test.listeners(); - - // Removes the default console output listener from the list so it will - // not receive events from Google Test and won't print any output. Since - // this operation transfers ownership of the listener to the caller we - // have to delete it as well. - delete listeners.Release(listeners.default_result_printer()); - - // Adds the custom output listener to the list. It will now receive - // events from Google Test and print the alternative output. We don't - // have to worry about deleting it since Google Test assumes ownership - // over it after adding it to the list. - listeners.Append(new TersePrinter); - } - int ret_val = RUN_ALL_TESTS(); - - // This is an example of using the UnitTest reflection API to inspect test - // results. Here we discount failures from the tests we expected to fail. - int unexpectedly_failed_tests = 0; - for (int i = 0; i < unit_test.total_test_case_count(); ++i) { - const TestCase& test_case = *unit_test.GetTestCase(i); - for (int j = 0; j < test_case.total_test_count(); ++j) { - const TestInfo& test_info = *test_case.GetTestInfo(j); - // Counts failed tests that were not meant to fail (those without - // 'Fails' in the name). - if (test_info.result()->Failed() && - strcmp(test_info.name(), "Fails") != 0) { - unexpectedly_failed_tests++; - } - } - } - - // Test that were meant to fail should not affect the test program outcome. - if (unexpectedly_failed_tests == 0) - ret_val = 0; - - return ret_val; -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/84d1e166/third_party/src/tmb/third_party/gtest/scripts/fuse_gtest_files.py ---------------------------------------------------------------------- diff --git a/third_party/src/tmb/third_party/gtest/scripts/fuse_gtest_files.py b/third_party/src/tmb/third_party/gtest/scripts/fuse_gtest_files.py deleted file mode 100755 index 57ef72f..0000000 --- a/third_party/src/tmb/third_party/gtest/scripts/fuse_gtest_files.py +++ /dev/null @@ -1,250 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2009, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""fuse_gtest_files.py v0.2.0 -Fuses Google Test source code into a .h file and a .cc file. - -SYNOPSIS - fuse_gtest_files.py [GTEST_ROOT_DIR] OUTPUT_DIR - - Scans GTEST_ROOT_DIR for Google Test source code, and generates - two files: OUTPUT_DIR/gtest/gtest.h and OUTPUT_DIR/gtest/gtest-all.cc. - Then you can build your tests by adding OUTPUT_DIR to the include - search path and linking with OUTPUT_DIR/gtest/gtest-all.cc. These - two files contain everything you need to use Google Test. Hence - you can "install" Google Test by copying them to wherever you want. - - GTEST_ROOT_DIR can be omitted and defaults to the parent - directory of the directory holding this script. - -EXAMPLES - ./fuse_gtest_files.py fused_gtest - ./fuse_gtest_files.py path/to/unpacked/gtest fused_gtest - -This tool is experimental. In particular, it assumes that there is no -conditional inclusion of Google Test headers. Please report any -problems to googletestframework@googlegroups.com. You can read -http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide for -more information. -""" - -__author__ = 'wan@google.com (Zhanyong Wan)' - -import os -import re -import sets -import sys - -# We assume that this file is in the scripts/ directory in the Google -# Test root directory. -DEFAULT_GTEST_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..') - -# Regex for matching '#include "gtest/..."'. -INCLUDE_GTEST_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(gtest/.+)"') - -# Regex for matching '#include "src/..."'. -INCLUDE_SRC_FILE_REGEX = re.compile(r'^\s*#\s*include\s*"(src/.+)"') - -# Where to find the source seed files. -GTEST_H_SEED = 'include/gtest/gtest.h' -GTEST_SPI_H_SEED = 'include/gtest/gtest-spi.h' -GTEST_ALL_CC_SEED = 'src/gtest-all.cc' - -# Where to put the generated files. -GTEST_H_OUTPUT = 'gtest/gtest.h' -GTEST_ALL_CC_OUTPUT = 'gtest/gtest-all.cc' - - -def VerifyFileExists(directory, relative_path): - """Verifies that the given file exists; aborts on failure. - - relative_path is the file path relative to the given directory. - """ - - if not os.path.isfile(os.path.join(directory, relative_path)): - print 'ERROR: Cannot find %s in directory %s.' % (relative_path, - directory) - print ('Please either specify a valid project root directory ' - 'or omit it on the command line.') - sys.exit(1) - - -def ValidateGTestRootDir(gtest_root): - """Makes sure gtest_root points to a valid gtest root directory. - - The function aborts the program on failure. - """ - - VerifyFileExists(gtest_root, GTEST_H_SEED) - VerifyFileExists(gtest_root, GTEST_ALL_CC_SEED) - - -def VerifyOutputFile(output_dir, relative_path): - """Verifies that the given output file path is valid. - - relative_path is relative to the output_dir directory. - """ - - # Makes sure the output file either doesn't exist or can be overwritten. - output_file = os.path.join(output_dir, relative_path) - if os.path.exists(output_file): - # TODO(wan@google.com): The following user-interaction doesn't - # work with automated processes. We should provide a way for the - # Makefile to force overwriting the files. - print ('%s already exists in directory %s - overwrite it? (y/N) ' % - (relative_path, output_dir)) - answer = sys.stdin.readline().strip() - if answer not in ['y', 'Y']: - print 'ABORTED.' - sys.exit(1) - - # Makes sure the directory holding the output file exists; creates - # it and all its ancestors if necessary. - parent_directory = os.path.dirname(output_file) - if not os.path.isdir(parent_directory): - os.makedirs(parent_directory) - - -def ValidateOutputDir(output_dir): - """Makes sure output_dir points to a valid output directory. - - The function aborts the program on failure. - """ - - VerifyOutputFile(output_dir, GTEST_H_OUTPUT) - VerifyOutputFile(output_dir, GTEST_ALL_CC_OUTPUT) - - -def FuseGTestH(gtest_root, output_dir): - """Scans folder gtest_root to generate gtest/gtest.h in output_dir.""" - - output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w') - processed_files = sets.Set() # Holds all gtest headers we've processed. - - def ProcessFile(gtest_header_path): - """Processes the given gtest header file.""" - - # We don't process the same header twice. - if gtest_header_path in processed_files: - return - - processed_files.add(gtest_header_path) - - # Reads each line in the given gtest header. - for line in file(os.path.join(gtest_root, gtest_header_path), 'r'): - m = INCLUDE_GTEST_FILE_REGEX.match(line) - if m: - # It's '#include "gtest/..."' - let's process it recursively. - ProcessFile('include/' + m.group(1)) - else: - # Otherwise we copy the line unchanged to the output file. - output_file.write(line) - - ProcessFile(GTEST_H_SEED) - output_file.close() - - -def FuseGTestAllCcToFile(gtest_root, output_file): - """Scans folder gtest_root to generate gtest/gtest-all.cc in output_file.""" - - processed_files = sets.Set() - - def ProcessFile(gtest_source_file): - """Processes the given gtest source file.""" - - # We don't process the same #included file twice. - if gtest_source_file in processed_files: - return - - processed_files.add(gtest_source_file) - - # Reads each line in the given gtest source file. - for line in file(os.path.join(gtest_root, gtest_source_file), 'r'): - m = INCLUDE_GTEST_FILE_REGEX.match(line) - if m: - if 'include/' + m.group(1) == GTEST_SPI_H_SEED: - # It's '#include "gtest/gtest-spi.h"'. This file is not - # #included by "gtest/gtest.h", so we need to process it. - ProcessFile(GTEST_SPI_H_SEED) - else: - # It's '#include "gtest/foo.h"' where foo is not gtest-spi. - # We treat it as '#include "gtest/gtest.h"', as all other - # gtest headers are being fused into gtest.h and cannot be - # #included directly. - - # There is no need to #include "gtest/gtest.h" more than once. - if not GTEST_H_SEED in processed_files: - processed_files.add(GTEST_H_SEED) - output_file.write('#include "%s"\n' % (GTEST_H_OUTPUT,)) - else: - m = INCLUDE_SRC_FILE_REGEX.match(line) - if m: - # It's '#include "src/foo"' - let's process it recursively. - ProcessFile(m.group(1)) - else: - output_file.write(line) - - ProcessFile(GTEST_ALL_CC_SEED) - - -def FuseGTestAllCc(gtest_root, output_dir): - """Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir.""" - - output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w') - FuseGTestAllCcToFile(gtest_root, output_file) - output_file.close() - - -def FuseGTest(gtest_root, output_dir): - """Fuses gtest.h and gtest-all.cc.""" - - ValidateGTestRootDir(gtest_root) - ValidateOutputDir(output_dir) - - FuseGTestH(gtest_root, output_dir) - FuseGTestAllCc(gtest_root, output_dir) - - -def main(): - argc = len(sys.argv) - if argc == 2: - # fuse_gtest_files.py OUTPUT_DIR - FuseGTest(DEFAULT_GTEST_ROOT_DIR, sys.argv[1]) - elif argc == 3: - # fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR - FuseGTest(sys.argv[1], sys.argv[2]) - else: - print __doc__ - sys.exit(1) - - -if __name__ == '__main__': - main()