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

Method TestFuncs

util/generic/string_ut.h:824–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822 // Test any other functions
823
824 void TestFuncs() {
825 TStringType s(Data._0123456());
826 UNIT_ASSERT(s.c_str() == s.data());
827
828 // length()
829 UNIT_ASSERT(s.length() == s.size());
830 UNIT_ASSERT(s.length() == traits_type::length(s.data()));
831
832 // is_null()
833 TStringType s1(Data.Empty());
834 UNIT_ASSERT(s1.is_null() == true);
835 UNIT_ASSERT(s1.is_null() == s1.empty());
836 UNIT_ASSERT(s1.is_null() == !s1);
837
838 TStringType s2(s);
839 UNIT_ASSERT(s2 == s);
840
841 // reverse()
842 ReverseInPlace(s2);
843 UNIT_ASSERT(s2 == Data._6543210());
844
845 // to_upper()
846 s2 = Data.asdf1234qwer();
847 s2.to_upper();
848 UNIT_ASSERT(s2 == Data.ASDF1234QWER());
849
850 // to_lower()
851 s2.to_lower();
852 UNIT_ASSERT(s2 == Data.asdf1234qwer());
853
854 // to_title()
855 s2 = Data.asDF1234qWEr();
856 s2.to_title();
857 UNIT_ASSERT(s2 == Data.Asdf1234qwer());
858
859 s2 = Data.AsDF1234qWEr();
860 s2.to_title();
861 UNIT_ASSERT(s2 == Data.Asdf1234qwer());
862
863 // Friend functions
864 s2 = Data.asdf1234qwer();
865 TStringType s3 = to_upper(s2);
866 UNIT_ASSERT(s3 == Data.ASDF1234QWER());
867 s3 = to_lower(s2);
868 UNIT_ASSERT(s3 == Data.asdf1234qwer());
869 s3 = to_title(s2);
870 UNIT_ASSERT(s3 == Data.Asdf1234qwer());
871 s2 = s3;
872
873 // resize family
874 s2.resize(s2.size()); // without length change
875 UNIT_ASSERT(s2 == Data.Asdf1234qwer());
876
877 s2.resize(s2.size() + 4, *Data.W());
878 UNIT_ASSERT(s2 == Data.Asdf1234qwerWWWW());
879
880 s2.resize(4);
881 UNIT_ASSERT(s2 == Data.Asdf());

Callers

nothing calls this directly

Calls 15

to_upperFunction · 0.85
to_lowerFunction · 0.85
ComputeHashFunction · 0.85
_0123456Method · 0.80
_6543210Method · 0.80
asdf1234qwerMethod · 0.80
ASDF1234QWERMethod · 0.80
asDF1234qWErMethod · 0.80
Asdf1234qwerMethod · 0.80
AsDF1234qWErMethod · 0.80
WMethod · 0.80
Asdf1234qwerWWWWMethod · 0.80

Tested by

no test coverage detected