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

Method TestStrip

util/charset/wide_ut.cpp:790–849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788 }
789
790 void TestStrip() {
791 TUtf16String s;
792
793 Strip(s);
794 UNIT_ASSERT(s == TUtf16String());
795 StripLeft(s);
796 UNIT_ASSERT(s == TUtf16String());
797 StripRight(s);
798 UNIT_ASSERT(s == TUtf16String());
799
800 s = ASCIIToWide(" \t\r\n");
801 Strip(s);
802 UNIT_ASSERT(s == TUtf16String());
803 s = ASCIIToWide(" \t\r\n");
804 StripLeft(s);
805 UNIT_ASSERT(s == TUtf16String());
806 s = ASCIIToWide(" \t\r\n");
807 StripRight(s);
808 UNIT_ASSERT(s == TUtf16String());
809
810 s = ASCIIToWide("\t\f\va \r\n");
811 Strip(s);
812 UNIT_ASSERT(s == ASCIIToWide("a"));
813 s = ASCIIToWide("\t\f\va \r\n");
814 StripLeft(s);
815 UNIT_ASSERT(s == ASCIIToWide("a \r\n"));
816 s = ASCIIToWide("\t\f\va \r\n");
817 StripRight(s);
818 UNIT_ASSERT(s == ASCIIToWide("\t\f\va"));
819
820 s = ASCIIToWide("\r\na\r\nb\t\tc\r\n");
821 Strip(s);
822 UNIT_ASSERT(s == ASCIIToWide("a\r\nb\t\tc"));
823 s = ASCIIToWide("\r\na\r\nb\t\tc\r\n");
824 StripLeft(s);
825 UNIT_ASSERT(s == ASCIIToWide("a\r\nb\t\tc\r\n"));
826 s = ASCIIToWide("\r\na\r\nb\t\tc\r\n");
827 StripRight(s);
828 UNIT_ASSERT(s == ASCIIToWide("\r\na\r\nb\t\tc"));
829
830 const TUtf16String w(ASCIIToWide("a b"));
831 s = w;
832 Strip(s);
833 UNIT_ASSERT(s == w);
834#ifndef TSTRING_IS_STD_STRING
835 UNIT_ASSERT(s.c_str() == w.c_str()); // Strip() does not change the string at all
836#endif
837 s = w;
838 StripLeft(s);
839 UNIT_ASSERT(s == w);
840#ifndef TSTRING_IS_STD_STRING
841 UNIT_ASSERT(s.c_str() == w.c_str()); // Strip() does not change the string at all
842#endif
843 s = w;
844 StripRight(s);
845 UNIT_ASSERT(s == w);
846#ifndef TSTRING_IS_STD_STRING
847 UNIT_ASSERT(s.c_str() == w.c_str()); // Strip() does not change the string at all

Callers

nothing calls this directly

Calls 5

StripRightFunction · 0.85
ASCIIToWideFunction · 0.85
StripFunction · 0.70
StripLeftFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected