Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-bc committed Jan 23, 2024
1 parent abc9cdf commit 1b67fd9
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Fw/Types/test/ut/TypesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Fw/Types/Assert.hpp>
#include <Fw/Types/String.hpp>
#include <Fw/Types/InternalInterfaceString.hpp>
#include <Fw/Types/ObjectName.hpp>
#include <Fw/Types/PolyType.hpp>
#include <Fw/Types/MallocAllocator.hpp>
//
Expand Down Expand Up @@ -1194,6 +1195,38 @@ TEST(TypesTest,EightyCharTest) {

}

TEST(TypesTest,ObjectNameTest) {
Fw::ObjectName str;
str = "foo";
Fw::ObjectName str2;
str2 = "foo";
ASSERT_EQ(str,str2);
ASSERT_EQ(str,"foo");
str2 = "_bar";
ASSERT_NE(str,str2);

Fw::ObjectName str3 = str;
str3 += str2;
ASSERT_EQ(str3,"foo_bar");

str3 += "xyzz";

Check failure on line 1212 in Fw/Types/test/ut/TypesTest.cpp

View workflow job for this annotation

GitHub Actions / Spell checking

`xyzz` is not a recognized word. (unrecognized-spelling)
ASSERT_EQ(str3,"foo_barxyzz");

Check failure on line 1213 in Fw/Types/test/ut/TypesTest.cpp

View workflow job for this annotation

GitHub Actions / Spell checking

`barxyzz` is not a recognized word. (unrecognized-spelling)


Fw::ObjectName copyStr("ASTRING");
ASSERT_EQ(copyStr,"ASTRING");
Fw::ObjectName copyStr2 = "ASTRING";
ASSERT_EQ(copyStr2,"ASTRING");
Fw::ObjectName copyStr3(copyStr2);
ASSERT_EQ(copyStr3,"ASTRING");

Fw::InternalInterfaceString ifstr("IfString");
Fw::ObjectName if2(ifstr);

ASSERT_EQ(ifstr,if2);
ASSERT_EQ(if2,"IfString");
}

TEST(TypesTest,StringFormatTest) {
Fw::String str;
str.format("Int %d String %s",10,"foo");
Expand Down

0 comments on commit 1b67fd9

Please sign in to comment.