MCPcopy Create free account
hub / github.com/catboost/catboost / TestPrefixSuffix

Method TestPrefixSuffix

util/generic/string_ut.h:985–1002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983 }
984
985 void TestPrefixSuffix() {
986 const TStringType emptyStr;
987 UNIT_ASSERT_EQUAL(emptyStr.StartsWith('x'), false);
988 UNIT_ASSERT_EQUAL(emptyStr.EndsWith('x'), false);
989 UNIT_ASSERT_EQUAL(emptyStr.StartsWith(0), false);
990 UNIT_ASSERT_EQUAL(emptyStr.EndsWith(0), false);
991 UNIT_ASSERT_EQUAL(emptyStr.StartsWith(emptyStr), true);
992 UNIT_ASSERT_EQUAL(emptyStr.EndsWith(emptyStr), true);
993
994 const char_type chars[] = {'h', 'e', 'l', 'l', 'o', 0};
995 const TStringType str(chars);
996 UNIT_ASSERT_EQUAL(str.StartsWith('h'), true);
997 UNIT_ASSERT_EQUAL(str.StartsWith('o'), false);
998 UNIT_ASSERT_EQUAL(str.EndsWith('o'), true);
999 UNIT_ASSERT_EQUAL(str.EndsWith('h'), false);
1000 UNIT_ASSERT_EQUAL(str.StartsWith(emptyStr), true);
1001 UNIT_ASSERT_EQUAL(str.EndsWith(emptyStr), true);
1002 }
1003
1004#ifndef TSTRING_IS_STD_STRING
1005 void TestCharRef() {

Callers

nothing calls this directly

Calls 2

StartsWithMethod · 0.45
EndsWithMethod · 0.45

Tested by

no test coverage detected