Skip to content

Commit

Permalink
Add POSIX tests
Browse files Browse the repository at this point in the history
b/316954263

Change-Id: I757da3e74823c3886a82597b5af2a6c6a2a1a87a
  • Loading branch information
madhurajayaraman committed Jan 8, 2024
1 parent 604b910 commit 39a4ee5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ namespace nplb {
namespace {

#if SB_API_VERSION >= 16
TEST(SbStringCompareNoCaseNTest, SunnyDaySelf) {
TEST(SbStringCompareNoCaseNPosixTest, SunnyDaySelf) {
const char kString[] = "0123456789";
EXPECT_EQ(0, strncasecmp(kString, kString, strlen(kString)));
EXPECT_EQ(0, strncasecmp("", "", 0));
}

TEST(SbStringCompareNoCaseNTest, SunnyDayEmptyLessThanNotEmpty) {
TEST(SbStringCompareNoCaseNPosixTest, SunnyDayEmptyLessThanNotEmpty) {
const char kString[] = "0123456789";
EXPECT_GT(0, strncasecmp("", kString, strlen(kString)));
}

TEST(SbStringCompareNoCaseNTest, SunnyDayEmptyZeroNEqual) {
TEST(SbStringCompareNoCaseNPosixTest, SunnyDayEmptyZeroNEqual) {
const char kString[] = "0123456789";
EXPECT_EQ(0, strncasecmp("", kString, 0));
}

TEST(SbStringCompareNoCaseNTest, SunnyDayBigN) {
TEST(SbStringCompareNoCaseNPosixTest, SunnyDayBigN) {
const char kString[] = "0123456789";
EXPECT_EQ(0, strncasecmp(kString, kString, strlen(kString) * 2));
}

TEST(SbStringCompareNoCaseNTest, SunnyDayCase) {
TEST(SbStringCompareNoCaseNPosixTest, SunnyDayCase) {
const char kString1[] = "aBcDeFgHiJkLmNoPqRsTuVwXyZ";
const char kString2[] = "AbCdEfGhIjKlMnOpQrStUvWxYz";
EXPECT_EQ(0, strncasecmp(kString1, kString2, strlen(kString1)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ namespace nplb {
namespace {

#if SB_API_VERSION >= 16
TEST(SbStringCompareNoCaseTest, SunnyDaySelf) {
TEST(SbStringCompareNoCasePosixTest, SunnyDaySelf) {
const char kString[] = "0123456789";
EXPECT_EQ(0, strcasecmp(kString, kString));
EXPECT_EQ(0, strcasecmp("", ""));
}

TEST(SbStringCompareNoCaseTest, SunnyDayEmptyLessThanNotEmpty) {
TEST(SbStringCompareNoCasePosixTest, SunnyDayEmptyLessThanNotEmpty) {
const char kString[] = "0123456789";
EXPECT_GT(0, strcasecmp("", kString));
}

TEST(SbStringCompareNoCaseTest, SunnyDayCase) {
TEST(SbStringCompareNoCasePosixTest, SunnyDayCase) {
const char kString1[] = "aBcDeFgHiJkLmNoPqRsTuVwXyZ";
const char kString2[] = "AbCdEfGhIjKlMnOpQrStUvWxYz";
EXPECT_EQ(0, strcasecmp(kString1, kString2));
Expand Down

0 comments on commit 39a4ee5

Please sign in to comment.