diff options
author | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 03:43:37 +0000 |
---|---|---|
committer | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 03:43:37 +0000 |
commit | a8815b3277284778247545728bc41a077ff55b43 (patch) | |
tree | b83885f677c4cdb57d8f84ad81f9d4b3d3d7fcfe /o3d | |
parent | 9513f20493f07ab43d68ccb55fa321086bf955b3 (diff) | |
download | chromium_src-a8815b3277284778247545728bc41a077ff55b43.zip chromium_src-a8815b3277284778247545728bc41a077ff55b43.tar.gz chromium_src-a8815b3277284778247545728bc41a077ff55b43.tar.bz2 |
Changes to make test project build.
Review URL: http://codereview.chromium.org/172081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23692 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/message_commands_test.cc | 308 | ||||
-rw-r--r-- | o3d/core/cross/message_queue_test.cc | 2 | ||||
-rw-r--r-- | o3d/core/cross/visitor_base_test.cc | 2 | ||||
-rw-r--r-- | o3d/statsreport/metrics_unittest.cc | 122 | ||||
-rw-r--r-- | o3d/tests/tests.gyp | 5 |
5 files changed, 219 insertions, 220 deletions
diff --git a/o3d/core/cross/message_commands_test.cc b/o3d/core/cross/message_commands_test.cc index c4303dc..93c0b72 100644 --- a/o3d/core/cross/message_commands_test.cc +++ b/o3d/core/cross/message_commands_test.cc @@ -1,160 +1,148 @@ -/*
- * 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.
- */
-
-#include <stddef.h>
-#include "core/cross/message_commands.h"
-#include "tests/common/win/testing_common.h"
-
-namespace o3d {
-
-class MessageCommandsTest : public testing::Test {
-};
-
-TEST_F(MessageCommandsTest, GetMessageDescription) {
- EXPECT_STREQ(imc::GetMessageDescription(
- imc::ALLOCATE_SHARED_MEMORY), "ALLOCATE_SHARED_MEMORY");
-}
-
-TEST_F(MessageCommandsTest, MessageInvalidIdTest) {
- EXPECT_EQ(static_cast<int>(imc::INVALID_ID), 0);
- //EXPECT_EQ(imc::INVALID_ID, MessageInvalidId::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageInvalidId::Msg, message_id));
- MessageInvalidId msg;
- EXPECT_EQ(imc::INVALID_ID, msg.msg.message_id);
- EXPECT_EQ(4u, sizeof msg.msg);
-}
-
-TEST_F(MessageCommandsTest, MessageHelloTest) {
- EXPECT_EQ(static_cast<int>(imc::HELLO), 1);
- //EXPECT_EQ(imc::HELLO, MessageHello::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageHello::Msg, message_id));
- MessageHello msg;
- EXPECT_EQ(imc::HELLO, msg.msg.message_id);
- EXPECT_EQ(4u, sizeof msg.msg);
-}
-
-TEST_F(MessageCommandsTest, MessageAllocateSharedMemoryTest) {
- EXPECT_EQ(static_cast<int>(imc::ALLOCATE_SHARED_MEMORY), 2);
- //EXPECT_EQ(imc::ALLOCATE_SHARED_MEMORY,
- // MessageAllocateSharedMemory::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageAllocateSharedMemory::Msg, message_id));
- EXPECT_EQ(4u, offsetof(MessageAllocateSharedMemory::Msg, mem_size));
- MessageAllocateSharedMemory msg;
- EXPECT_EQ(imc::ALLOCATE_SHARED_MEMORY, msg.msg.message_id);
- EXPECT_EQ(8u, sizeof msg.msg);
- MessageAllocateSharedMemory msg2(3);
- EXPECT_EQ(imc::ALLOCATE_SHARED_MEMORY, msg2.msg.message_id);
- EXPECT_EQ(3, msg2.msg.mem_size);
-}
-
-TEST_F(MessageCommandsTest, MessageUpdateTexture2D) {
- EXPECT_EQ(static_cast<int>(imc::UPDATE_TEXTURE2D), 3);
- //EXPECT_EQ(imc::UPDATE_TEXTURE2D,
- // MessageUpdateTexture2D::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageUpdateTexture2D::Msg, message_id));
- EXPECT_EQ(4u, offsetof(MessageUpdateTexture2D::Msg, texture_id));
- EXPECT_EQ(8u, offsetof(MessageUpdateTexture2D::Msg, level));
- EXPECT_EQ(12u, offsetof(MessageUpdateTexture2D::Msg, shared_memory_id));
- EXPECT_EQ(16u, offsetof(MessageUpdateTexture2D::Msg, offset));
- EXPECT_EQ(20u, offsetof(MessageUpdateTexture2D::Msg, number_of_bytes));
- MessageUpdateTexture2D msg;
- EXPECT_EQ(imc::UPDATE_TEXTURE2D, msg.msg.message_id);
- EXPECT_EQ(24u, sizeof msg.msg);
- MessageUpdateTexture2D msg2(2, 3, 4, 5, 6);
- EXPECT_EQ(imc::UPDATE_TEXTURE2D, msg2.msg.message_id);
- EXPECT_EQ(2, msg2.msg.texture_id);
- EXPECT_EQ(3, msg2.msg.level);
- EXPECT_EQ(4, msg2.msg.shared_memory_id);
- EXPECT_EQ(5, msg2.msg.offset);
- EXPECT_EQ(6, msg2.msg.number_of_bytes);
-}
-
-TEST_F(MessageCommandsTest, MessageRegisterSharedMemory) {
- EXPECT_EQ(static_cast<int>(imc::REGISTER_SHARED_MEMORY), 4);
- //EXPECT_EQ(imc::REGISTER_SHARED_MEMORY,
- // MessageRegisterSharedMemory::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageRegisterSharedMemory::Msg, message_id));
- EXPECT_EQ(4u, offsetof(MessageRegisterSharedMemory::Msg, mem_size));
- MessageRegisterSharedMemory msg;
- EXPECT_EQ(imc::REGISTER_SHARED_MEMORY, msg.msg.message_id);
- EXPECT_EQ(8u, sizeof msg.msg);
- MessageRegisterSharedMemory msg2(123);
- EXPECT_EQ(imc::REGISTER_SHARED_MEMORY, msg2.msg.message_id);
- EXPECT_EQ(123, msg2.msg.mem_size);
-}
-
-TEST_F(MessageCommandsTest, MessageUnregisterSharedMemory) {
- EXPECT_EQ(static_cast<int>(imc::UNREGISTER_SHARED_MEMORY), 5);
- //EXPECT_EQ(imc::UNREGISTER_SHARED_MEMORY,
- // MessageUnregisterSharedMemory::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageUnregisterSharedMemory::Msg, message_id));
- EXPECT_EQ(4u, offsetof(MessageUnregisterSharedMemory::Msg, buffer_id));
- MessageUnregisterSharedMemory msg;
- EXPECT_EQ(imc::UNREGISTER_SHARED_MEMORY, msg.msg.message_id);
- EXPECT_EQ(8u, sizeof msg.msg);
- MessageUnregisterSharedMemory msg2(2);
- EXPECT_EQ(imc::UNREGISTER_SHARED_MEMORY, msg2.msg.message_id);
- EXPECT_EQ(2, msg2.msg.buffer_id);
-}
-
-TEST_F(MessageCommandsTest, MessageUpdateTexture2DRect) {
- EXPECT_EQ(static_cast<int>(imc::UPDATE_TEXTURE2D_RECT), 6);
- //EXPECT_EQ(imc::UPDATE_TEXTURE2D_RECT,
- // MessageUpdateTexture2DRect::Msg::KMessageId);
- EXPECT_EQ(0u, offsetof(MessageUpdateTexture2DRect::Msg, message_id));
- EXPECT_EQ(4u, offsetof(MessageUpdateTexture2DRect::Msg, texture_id));
- EXPECT_EQ(8u, offsetof(MessageUpdateTexture2DRect::Msg, level));
- EXPECT_EQ(12u, offsetof(MessageUpdateTexture2DRect::Msg, x));
- EXPECT_EQ(16u, offsetof(MessageUpdateTexture2DRect::Msg, y));
- EXPECT_EQ(20u, offsetof(MessageUpdateTexture2DRect::Msg, width));
- EXPECT_EQ(24u, offsetof(MessageUpdateTexture2DRect::Msg, height));
- EXPECT_EQ(28u, offsetof(MessageUpdateTexture2DRect::Msg, shared_memory_id));
- EXPECT_EQ(32u, offsetof(MessageUpdateTexture2DRect::Msg, offset));
- EXPECT_EQ(36u, offsetof(MessageUpdateTexture2DRect::Msg, pitch));
- MessageUpdateTexture2DRect msg;
- EXPECT_EQ(imc::UPDATE_TEXTURE2D_RECT, msg.msg.message_id);
- EXPECT_EQ(40u, sizeof msg.msg);
- MessageUpdateTexture2DRect msg2(2, 3, 4, 5, 6, 7, 8, 9, 10);
- EXPECT_EQ(imc::UPDATE_TEXTURE2D_RECT, msg2.msg.message_id);
- EXPECT_EQ(2, msg2.msg.texture_id);
- EXPECT_EQ(3, msg2.msg.level);
- EXPECT_EQ(4, msg2.msg.x);
- EXPECT_EQ(5, msg2.msg.y);
- EXPECT_EQ(6, msg2.msg.width);
- EXPECT_EQ(7, msg2.msg.height);
- EXPECT_EQ(8, msg2.msg.shared_memory_id);
- EXPECT_EQ(9, msg2.msg.offset);
- EXPECT_EQ(10, msg2.msg.pitch);
-}
-
-} // namespace o3d
-
-
+/* + * 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. + */ + +#include <stddef.h> +#include "core/cross/message_commands.h" +#include "tests/common/win/testing_common.h" + +namespace o3d { + +class MessageCommandsTest : public testing::Test { +}; + +TEST_F(MessageCommandsTest, GetMessageDescription) { + EXPECT_STREQ(imc::GetMessageDescription( + imc::ALLOCATE_SHARED_MEMORY), "ALLOCATE_SHARED_MEMORY"); +} + +TEST_F(MessageCommandsTest, MessageInvalidIdTest) { + EXPECT_EQ(static_cast<int>(imc::INVALID_ID), 0); + EXPECT_EQ(0u, offsetof(MessageInvalidId::Msg, message_id)); + MessageInvalidId msg; + EXPECT_EQ(imc::INVALID_ID, msg.msg.message_id); + EXPECT_EQ(4u, sizeof msg.msg); +} + +TEST_F(MessageCommandsTest, MessageHelloTest) { + EXPECT_EQ(static_cast<int>(imc::HELLO), 1); + EXPECT_EQ(0u, offsetof(MessageHello::Msg, message_id)); + MessageHello msg; + EXPECT_EQ(imc::HELLO, msg.msg.message_id); + EXPECT_EQ(4u, sizeof msg.msg); +} + +TEST_F(MessageCommandsTest, MessageAllocateSharedMemoryTest) { + EXPECT_EQ(static_cast<int>(imc::ALLOCATE_SHARED_MEMORY), 2); + EXPECT_EQ(0u, offsetof(MessageAllocateSharedMemory::Msg, message_id)); + EXPECT_EQ(4u, offsetof(MessageAllocateSharedMemory::Msg, mem_size)); + MessageAllocateSharedMemory msg; + EXPECT_EQ(imc::ALLOCATE_SHARED_MEMORY, msg.msg.message_id); + EXPECT_EQ(8u, sizeof msg.msg); + MessageAllocateSharedMemory msg2(3); + EXPECT_EQ(imc::ALLOCATE_SHARED_MEMORY, msg2.msg.message_id); + EXPECT_EQ(3, msg2.msg.mem_size); +} + +TEST_F(MessageCommandsTest, MessageUpdateTexture2D) { + EXPECT_EQ(static_cast<int>(imc::UPDATE_TEXTURE2D), 3); + EXPECT_EQ(0u, offsetof(MessageUpdateTexture2D::Msg, message_id)); + EXPECT_EQ(4u, offsetof(MessageUpdateTexture2D::Msg, texture_id)); + EXPECT_EQ(8u, offsetof(MessageUpdateTexture2D::Msg, level)); + EXPECT_EQ(12u, offsetof(MessageUpdateTexture2D::Msg, shared_memory_id)); + EXPECT_EQ(16u, offsetof(MessageUpdateTexture2D::Msg, offset)); + EXPECT_EQ(20u, offsetof(MessageUpdateTexture2D::Msg, number_of_bytes)); + MessageUpdateTexture2D msg; + EXPECT_EQ(imc::UPDATE_TEXTURE2D, msg.msg.message_id); + EXPECT_EQ(24u, sizeof msg.msg); + MessageUpdateTexture2D msg2(2, 3, 4, 5, 6); + EXPECT_EQ(imc::UPDATE_TEXTURE2D, msg2.msg.message_id); + EXPECT_EQ(2u, msg2.msg.texture_id); + EXPECT_EQ(3, msg2.msg.level); + EXPECT_EQ(4, msg2.msg.shared_memory_id); + EXPECT_EQ(5, msg2.msg.offset); + EXPECT_EQ(6, msg2.msg.number_of_bytes); +} + +TEST_F(MessageCommandsTest, MessageRegisterSharedMemory) { + EXPECT_EQ(static_cast<int>(imc::REGISTER_SHARED_MEMORY), 4); + EXPECT_EQ(0u, offsetof(MessageRegisterSharedMemory::Msg, message_id)); + EXPECT_EQ(4u, offsetof(MessageRegisterSharedMemory::Msg, mem_size)); + MessageRegisterSharedMemory msg; + EXPECT_EQ(imc::REGISTER_SHARED_MEMORY, msg.msg.message_id); + EXPECT_EQ(8u, sizeof msg.msg); + MessageRegisterSharedMemory msg2(123); + EXPECT_EQ(imc::REGISTER_SHARED_MEMORY, msg2.msg.message_id); + EXPECT_EQ(123, msg2.msg.mem_size); +} + +TEST_F(MessageCommandsTest, MessageUnregisterSharedMemory) { + EXPECT_EQ(static_cast<int>(imc::UNREGISTER_SHARED_MEMORY), 5); + EXPECT_EQ(0u, offsetof(MessageUnregisterSharedMemory::Msg, message_id)); + EXPECT_EQ(4u, offsetof(MessageUnregisterSharedMemory::Msg, buffer_id)); + MessageUnregisterSharedMemory msg; + EXPECT_EQ(imc::UNREGISTER_SHARED_MEMORY, msg.msg.message_id); + EXPECT_EQ(8u, sizeof msg.msg); + MessageUnregisterSharedMemory msg2(2); + EXPECT_EQ(imc::UNREGISTER_SHARED_MEMORY, msg2.msg.message_id); + EXPECT_EQ(2, msg2.msg.buffer_id); +} + +TEST_F(MessageCommandsTest, MessageUpdateTexture2DRect) { + EXPECT_EQ(static_cast<int>(imc::UPDATE_TEXTURE2D_RECT), 6); + EXPECT_EQ(0u, offsetof(MessageUpdateTexture2DRect::Msg, message_id)); + EXPECT_EQ(4u, offsetof(MessageUpdateTexture2DRect::Msg, texture_id)); + EXPECT_EQ(8u, offsetof(MessageUpdateTexture2DRect::Msg, level)); + EXPECT_EQ(12u, offsetof(MessageUpdateTexture2DRect::Msg, x)); + EXPECT_EQ(16u, offsetof(MessageUpdateTexture2DRect::Msg, y)); + EXPECT_EQ(20u, offsetof(MessageUpdateTexture2DRect::Msg, width)); + EXPECT_EQ(24u, offsetof(MessageUpdateTexture2DRect::Msg, height)); + EXPECT_EQ(28u, offsetof(MessageUpdateTexture2DRect::Msg, shared_memory_id)); + EXPECT_EQ(32u, offsetof(MessageUpdateTexture2DRect::Msg, offset)); + EXPECT_EQ(36u, offsetof(MessageUpdateTexture2DRect::Msg, pitch)); + MessageUpdateTexture2DRect msg; + EXPECT_EQ(imc::UPDATE_TEXTURE2D_RECT, msg.msg.message_id); + EXPECT_EQ(40u, sizeof msg.msg); + MessageUpdateTexture2DRect msg2(2, 3, 4, 5, 6, 7, 8, 9, 10); + EXPECT_EQ(imc::UPDATE_TEXTURE2D_RECT, msg2.msg.message_id); + EXPECT_EQ(2u, msg2.msg.texture_id); + EXPECT_EQ(3, msg2.msg.level); + EXPECT_EQ(4, msg2.msg.x); + EXPECT_EQ(5, msg2.msg.y); + EXPECT_EQ(6, msg2.msg.width); + EXPECT_EQ(7, msg2.msg.height); + EXPECT_EQ(8, msg2.msg.shared_memory_id); + EXPECT_EQ(9, msg2.msg.offset); + EXPECT_EQ(10, msg2.msg.pitch); +} + +} // namespace o3d + + diff --git a/o3d/core/cross/message_queue_test.cc b/o3d/core/cross/message_queue_test.cc index d03b3b3..3bc3941 100644 --- a/o3d/core/cross/message_queue_test.cc +++ b/o3d/core/cross/message_queue_test.cc @@ -50,7 +50,6 @@ using ::base::TimeDelta; namespace o3d { -namespace { //---------------------------------------------------------------------- // These are helper classes for the little multithreaded test harness // below. @@ -566,7 +565,6 @@ bool TextureUpdateHelper::UnregisterSharedMemory(int shared_memory_id) { } -} // anonymous namespace. //---------------------------------------------------------------------- // This is the main class containing all of the other ones. It knows diff --git a/o3d/core/cross/visitor_base_test.cc b/o3d/core/cross/visitor_base_test.cc index a827bf4..8985dcb 100644 --- a/o3d/core/cross/visitor_base_test.cc +++ b/o3d/core/cross/visitor_base_test.cc @@ -40,7 +40,6 @@ namespace o3d { -namespace { class TestClass : public ObjectBase { public: explicit TestClass(ServiceLocator* service_locator) @@ -78,7 +77,6 @@ class TestVisitor : public VisitorBase<TestVisitor> { int visit_test_class_calls_; TestClass* visit_test_class_param_; }; -} class VisitorBaseTest : public testing::Test { protected: diff --git a/o3d/statsreport/metrics_unittest.cc b/o3d/statsreport/metrics_unittest.cc index 3aea6fa..8d2dbc6 100644 --- a/o3d/statsreport/metrics_unittest.cc +++ b/o3d/statsreport/metrics_unittest.cc @@ -30,12 +30,22 @@ */ +#ifndef OS_WIN +#include <unistd.h> +#endif + // Metrics report unit testing #include <new> #include <algorithm> #include "gtest/gtest.h" #include "metrics.h" +#ifdef OS_WIN +#define SLEEP_ONE_SECOND() ::Sleep(1000) +#else +#define SLEEP_ONE_SECOND() ::sleep(1) +#endif + DECLARE_METRIC_count(count); DEFINE_METRIC_count(count); @@ -62,7 +72,6 @@ using ::stats_report::kCountType; using ::stats_report::kIntegerType; using ::stats_report::kTimingType; -namespace { class MetricsTest: public testing::Test { protected: @@ -90,19 +99,18 @@ class MetricsEnumTest: public MetricsTest { BoolMetric bool_; }; -} // namespace // Validates that the above-declared metrics are available // in the expected namespace TEST_F(MetricsTest, Globals) { - EXPECT_EQ(0, ::metric_count.Reset()); + EXPECT_EQ(0u, ::metric_count.Reset()); TimingMetric::TimingData data = ::metric_timing.Reset(); - EXPECT_EQ(0, data.count); - EXPECT_EQ(0, data.maximum); - EXPECT_EQ(0, data.minimum); - EXPECT_EQ(0, data.sum); + EXPECT_EQ(0u, data.count); + EXPECT_EQ(0u, data.maximum); + EXPECT_EQ(0u, data.minimum); + EXPECT_EQ(0u, data.sum); - EXPECT_EQ(0, ::metric_integer.value()); + EXPECT_EQ(0u, ::metric_integer.value()); EXPECT_EQ(BoolMetric::kBoolUnset, ::metric_bool.Reset()); // Check for correct initialization @@ -140,7 +148,7 @@ TEST_F(MetricsTest, CollectionInitialization) { TEST_F(MetricsTest, Count) { CountMetric foo("foo", &coll_); - EXPECT_EQ(0, foo.Reset()); + EXPECT_EQ(0u, foo.Reset()); EXPECT_EQ(kCountType, foo.type()); ASSERT_TRUE(NULL != foo.AsCount()); ASSERT_TRUE(NULL == foo.AsTiming()); @@ -148,12 +156,12 @@ TEST_F(MetricsTest, Count) { ASSERT_TRUE(NULL == foo.AsBool()); ++foo; - EXPECT_EQ(1, foo.value()); + EXPECT_EQ(1u, foo.value()); foo++; - EXPECT_EQ(2, foo.value()); + EXPECT_EQ(2u, foo.value()); foo += 100; - EXPECT_EQ(102, foo.value()); + EXPECT_EQ(102u, foo.value()); } TEST_F(MetricsTest, Timing) { @@ -168,32 +176,32 @@ TEST_F(MetricsTest, Timing) { foo.AddSample(100); foo.AddSample(50); - EXPECT_EQ(2, foo.count()); - EXPECT_EQ(150, foo.sum()); - EXPECT_EQ(100, foo.maximum()); - EXPECT_EQ(50, foo.minimum()); - EXPECT_EQ(75, foo.average()); + EXPECT_EQ(2u, foo.count()); + EXPECT_EQ(150u, foo.sum()); + EXPECT_EQ(100u, foo.maximum()); + EXPECT_EQ(50u, foo.minimum()); + EXPECT_EQ(75u, foo.average()); TimingMetric::TimingData data = foo.Reset(); - EXPECT_EQ(2, data.count); - EXPECT_EQ(150, data.sum); - EXPECT_EQ(100, data.maximum); - EXPECT_EQ(50, data.minimum); + EXPECT_EQ(2u, data.count); + EXPECT_EQ(150u, data.sum); + EXPECT_EQ(100u, data.maximum); + EXPECT_EQ(50u, data.minimum); - EXPECT_EQ(0, foo.count()); - EXPECT_EQ(0, foo.sum()); - EXPECT_EQ(0, foo.maximum()); - EXPECT_EQ(0, foo.minimum()); - EXPECT_EQ(0, foo.average()); + EXPECT_EQ(0u, foo.count()); + EXPECT_EQ(0u, foo.sum()); + EXPECT_EQ(0u, foo.maximum()); + EXPECT_EQ(0u, foo.minimum()); + EXPECT_EQ(0u, foo.average()); // Test counted samples - foo.AddSamples(10, 1000); - foo.AddSamples(10, 500); - EXPECT_EQ(20, foo.count()); - EXPECT_EQ(1500, foo.sum()); - EXPECT_EQ(100, foo.maximum()); - EXPECT_EQ(50, foo.minimum()); - EXPECT_EQ(75, foo.average()); + foo.AddSamples(10u, 1000); + foo.AddSamples(10u, 500); + EXPECT_EQ(20u, foo.count()); + EXPECT_EQ(1500u, foo.sum()); + EXPECT_EQ(100u, foo.maximum()); + EXPECT_EQ(50u, foo.minimum()); + EXPECT_EQ(75u, foo.average()); } TEST_F(MetricsTest, TimingSample) { @@ -203,26 +211,26 @@ TEST_F(MetricsTest, TimingSample) { { TimingSample sample(&foo); - ::Sleep(30); + SLEEP_ONE_SECOND(); } TimingMetric::TimingData data = foo.Reset(); // Should be precisely one sample in there - EXPECT_EQ(1, data.count); + EXPECT_EQ(1u, data.count); // again, this time with a non-unity count { TimingSample sample(&foo, 2); - EXPECT_EQ(2, sample.count()); - ::Sleep(30); + EXPECT_EQ(2u, sample.count()); + SLEEP_ONE_SECOND(); } data = foo.Reset(); // Should be precisely two samples in there - EXPECT_EQ(2, data.count); + EXPECT_EQ(2u, data.count); // now with zero count { @@ -232,7 +240,7 @@ TEST_F(MetricsTest, TimingSample) { data = foo.Reset(); // Should be no samples in there - EXPECT_EQ(0, data.count); + EXPECT_EQ(0u, data.count); } TEST_F(MetricsTest, Integer) { @@ -244,28 +252,28 @@ TEST_F(MetricsTest, Integer) { ASSERT_TRUE(NULL != foo.AsInteger()); ASSERT_TRUE(NULL == foo.AsBool()); - EXPECT_EQ(0, foo.value()); + EXPECT_EQ(0u, foo.value()); foo.Set(1005); - EXPECT_EQ(1005, foo.value()); + EXPECT_EQ(1005u, foo.value()); foo = 1009UL; - EXPECT_EQ(1009, foo.value()); + EXPECT_EQ(1009u, foo.value()); foo.Set(0); ++foo; - EXPECT_EQ(1, foo.value()); + EXPECT_EQ(1u, foo.value()); foo++; - EXPECT_EQ(2, foo.value()); + EXPECT_EQ(2u, foo.value()); foo += 100; - EXPECT_EQ(102, foo.value()); + EXPECT_EQ(102u, foo.value()); foo -= 100; - EXPECT_EQ(2, foo.value()); + EXPECT_EQ(2u, foo.value()); foo--; - EXPECT_EQ(1, foo.value()); + EXPECT_EQ(1u, foo.value()); --foo; - EXPECT_EQ(0, foo.value()); + EXPECT_EQ(0u, foo.value()); } TEST_F(MetricsTest, Bool) { @@ -293,7 +301,8 @@ TEST_F(MetricsEnumTest, Enumeration) { &bool_, }; - for (int i = 0; i < sizeof(metrics) / sizeof(metrics[0]); ++i) { + int limit = sizeof(metrics) / sizeof(metrics[0]); + for (int i = 0; i < limit; ++i) { MetricBase *stat = metrics[i]; MetricBase *curr = coll_.first(); @@ -337,7 +346,8 @@ TEST_F(MetricsEnumTest, Iterator) { } // and that all metrics can be found - for (int i = 0; i < sizeof(metrics) / sizeof(metrics[0]); ++i) { + int limit = sizeof(metrics) / sizeof(metrics[0]); + for (int i = 0; i < limit; ++i) { MetricBase *stat = metrics[i]; EXPECT_EQ(stat, *std::find(MetricIterator(coll_), end, stat)); @@ -347,7 +357,7 @@ TEST_F(MetricsEnumTest, Iterator) { TEST_F(MetricsTest, SimpleConstruction) { const CountMetric c("c", 100); - EXPECT_EQ(100, c.value()); + EXPECT_EQ(100u, c.value()); EXPECT_EQ(kCountType, c.type()); EXPECT_STREQ("c", c.name()); EXPECT_TRUE(NULL == c.next()); @@ -355,17 +365,17 @@ TEST_F(MetricsTest, SimpleConstruction) { TimingMetric::TimingData data = { 10, 0, 1000, 10, 500 }; const TimingMetric t("t", data); - EXPECT_EQ(10, t.count()); - EXPECT_EQ(1000, t.sum()); - EXPECT_EQ(10, t.minimum()); - EXPECT_EQ(500, t.maximum()); + EXPECT_EQ(10u, t.count()); + EXPECT_EQ(1000u, t.sum()); + EXPECT_EQ(10u, t.minimum()); + EXPECT_EQ(500u, t.maximum()); EXPECT_EQ(kTimingType, t.type()); EXPECT_STREQ("t", t.name()); EXPECT_TRUE(NULL == t.next()); const IntegerMetric i("i", 200); - EXPECT_EQ(200, i.value()); + EXPECT_EQ(200u, i.value()); EXPECT_EQ(kIntegerType, i.type()); EXPECT_STREQ("i", i.name()); EXPECT_TRUE(NULL == i.next()); diff --git a/o3d/tests/tests.gyp b/o3d/tests/tests.gyp index 34a6d30..2f1742b 100644 --- a/o3d/tests/tests.gyp +++ b/o3d/tests/tests.gyp @@ -93,7 +93,12 @@ ], 'link_settings': { 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AGL.framework', '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + '$(SDKROOT)/System/Library/Frameworks/GLUT.framework', + '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', + '../../third_party/cg/files/mac/Cg.framework', + '../../third_party/glew/files/lib/libGLEW.a', ], }, }, |