You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by gr...@apache.org on 2011/02/01 11:13:42 UTC

svn commit: r1065979 - in /incubator/etch/trunk/binding-cpp/runtime/src/test: CMakeLists.txt common/EtchBoolTest.cpp common/EtchByteTest.cpp common/EtchDoubleTest.cpp common/EtchFloatTest.cpp common/EtchLongTest.cpp common/EtchShortTest.cpp

Author: grandyho
Date: Tue Feb  1 10:13:41 2011
New Revision: 1065979

URL: http://svn.apache.org/viewvc?rev=1065979&view=rev
Log:
ETCH-150 etch primitive type tests

Added:
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1065979&r1=1065978&r2=1065979&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Tue Feb  1 10:13:41 2011
@@ -28,6 +28,12 @@ add_executable (etch-cpp-test
     ${GTEST}/src/gtest-all.cc
     ${GTEST}/src/gtest_main.cc
     common/EtchInt32Test.cpp
+    common/EtchBoolTest.cpp
+    common/EtchByteTest.cpp
+    common/EtchShortTest.cpp
+    common/EtchLongTest.cpp
+    common/EtchFloatTest.cpp
+    common/EtchDoubleTest.cpp
     common/EtchStringTest.cpp
     common/EtchObjectTest.cpp
     common/EtchListTest.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchBool.h"
+
+// Tests positive input.
+TEST(EtchBoolTest, Constructor_Default) {
+    EtchBool* i1 = new EtchBool();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
+    EXPECT_TRUE(i1->get() == false);
+    delete i1;
+}
+
+TEST(EtchBoolTest, Constructor_Bool) {
+    EtchBool* i1 = new EtchBool(true);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
+    EXPECT_TRUE(i1->get() == true);
+    delete i1;
+}
+
+TEST(EtchBoolTest, set) {
+    EtchBool* i1 = new EtchBool();
+    i1->set(true);
+    EXPECT_TRUE(i1->get() == true);
+    delete i1;
+}
+
+TEST(EtchBoolTest, get) {
+    EtchBool* i1 = new EtchBool();
+    EXPECT_TRUE(i1->get() == false);
+    i1->set(true);
+    EXPECT_TRUE(i1->get() == true);
+    delete i1;
+}

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchByte.h"
+
+// Tests positive input.
+TEST(EtchByteTest, Constructor_Default) {
+    EtchByte* i1 = new EtchByte();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 0);
+    delete i1;
+}
+
+TEST(EtchByteTest, Constructor_Byte) {
+    EtchByte* i1 = new EtchByte(42);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 42);
+    delete i1;
+}
+
+TEST(EtchByteTest, set) {
+    EtchByte* i1 = new EtchByte();
+    i1->set(43);
+    EXPECT_TRUE(i1->get() == 43);
+    delete i1;
+}
+
+TEST(EtchByteTest, get) {
+    EtchByte* i1 = new EtchByte();
+    EXPECT_TRUE(i1->get() == 0);
+    i1->set(41);
+    EXPECT_TRUE(i1->get() == 41);
+    delete i1;
+}

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchDouble.h"
+
+// Tests positive input.
+TEST(EtchDoubleTest, Constructor_Default) {
+    EtchDouble* i1 = new EtchDouble();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 0.0L);
+    delete i1;
+}
+
+TEST(EtchDoubleTest, Constructor_Double) {
+    EtchDouble* i1 = new EtchDouble(42.0L);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 42.0L);
+    delete i1;
+}
+
+TEST(EtchDoubleTest, set) {
+    EtchDouble* i1 = new EtchDouble();
+    i1->set(43.0L);
+    EXPECT_EQ(i1->get(), 43.0L);
+    delete i1;
+}
+
+TEST(EtchDoubleTest, get) {
+    EtchDouble* i1 = new EtchDouble();
+    EXPECT_TRUE(i1->get() == 0.0L);
+    i1->set(41.0L);
+    EXPECT_TRUE(i1->get() == 41.0L);
+    delete i1;
+}

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchFloat.h"
+
+// Tests positive input.
+TEST(EtchFloatTest, Constructor_Default) {
+    EtchFloat* i1 = new EtchFloat();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 0.0f);
+    delete i1;
+}
+
+TEST(EtchFloatTest, Constructor_Float) {
+    EtchFloat* i1 = new EtchFloat(42.0f);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 42.0f);
+    delete i1;
+}
+
+TEST(EtchFloatTest, set) {
+    EtchFloat* i1 = new EtchFloat();
+    i1->set(43.33f);
+    EXPECT_TRUE(i1->get() == 43.33f);
+    delete i1;
+}
+
+TEST(EtchFloatTest, get) {
+    EtchFloat* i1 = new EtchFloat();
+    EXPECT_TRUE(i1->get() == 0.0f);
+    i1->set(41.0f);
+    EXPECT_TRUE(i1->get() == 41.0f);
+    delete i1;
+}

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchLong.h"
+
+// Tests positive input.
+TEST(EtchLongTest, Constructor_Default) {
+    EtchLong* i1 = new EtchLong();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 0);
+    delete i1;
+}
+
+TEST(EtchLongTest, Constructor_Long) {
+    EtchLong* i1 = new EtchLong(42);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 42);
+    delete i1;
+}
+
+TEST(EtchLongTest, set) {
+    EtchLong* i1 = new EtchLong();
+    i1->set(43000000);
+    EXPECT_TRUE(i1->get() == 43000000);
+    delete i1;
+}
+
+TEST(EtchLongTest, get) {
+    EtchLong* i1 = new EtchLong();
+    EXPECT_TRUE(i1->get() == 0);
+    i1->set(41);
+    EXPECT_TRUE(i1->get() == 41);
+    delete i1;
+}

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp?rev=1065979&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp Tue Feb  1 10:13:41 2011
@@ -0,0 +1,50 @@
+/* $Id$ 
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
+ * contributor license agreements. See the NOTICE file distributed with  
+ * this work for additional information regarding copyright ownership. 
+ * The ASF licenses this file to you under the Apache License, Version  
+ * 2.0 (the "License"); you may not use this file except in compliance  
+ * with the License. You may obtain a copy of the License at 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ */
+
+#include <gtest/gtest.h>
+#include "common/EtchShort.h"
+
+// Tests positive input.
+TEST(EtchShortTest, Constructor_Default) {
+    EtchShort* i1 = new EtchShort();
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 0);
+    delete i1;
+}
+
+TEST(EtchShortTest, Constructor_Short) {
+    EtchShort* i1 = new EtchShort(42);
+    EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
+    EXPECT_TRUE(i1->get() == 42);
+    delete i1;
+}
+
+TEST(EtchShortTest, set) {
+    EtchShort* i1 = new EtchShort();
+    i1->set(43);
+    EXPECT_TRUE(i1->get() == 43);
+    delete i1;
+}
+
+TEST(EtchShortTest, get) {
+    EtchShort* i1 = new EtchShort();
+    EXPECT_TRUE(i1->get() == 0);
+    i1->set(41);
+    EXPECT_TRUE(i1->get() == 41);
+    delete i1;
+}