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

Method TestConstructors

util/generic/string_ut.h:527–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525 }
526
527 void TestConstructors() {
528 TStringType s0;
529 UNIT_ASSERT(s0.size() == 0);
530
531 TStringType s;
532 TStringType s1(*Data._0());
533 TStringType s2(Data._0());
534 UNIT_ASSERT(s1 == s2);
535
536 TStringType fromChar(char_type('a'));
537 UNIT_ASSERT_VALUES_EQUAL(fromChar.size(), 1u);
538 UNIT_ASSERT_VALUES_EQUAL(fromChar[0], char_type('a'));
539
540#ifndef TSTRING_IS_STD_STRING
541 TStringType s3 = TStringType::Uninitialized(10);
542 UNIT_ASSERT(s3.size() == 10);
543#endif
544
545 TStringType s4(Data._0123456(), 1, 3);
546 UNIT_ASSERT(s4 == Data._123());
547
548 TStringType s5(5, *Data._0());
549 UNIT_ASSERT(s5 == Data._00000());
550
551 TStringType s6(Data._0123456());
552 UNIT_ASSERT(s6 == Data._0123456());
553 TStringType s7(s6);
554 UNIT_ASSERT(s7 == s6);
555#ifndef TSTRING_IS_STD_STRING
556 UNIT_ASSERT(s7.c_str() == s6.c_str());
557#endif
558
559 TStringType s8(s7, 1, 3);
560 UNIT_ASSERT(s8 == Data._123());
561
562 TStringType s9(*Data._1());
563 UNIT_ASSERT(s9 == Data._1());
564
565 TStringType s10(Reserve(100));
566 UNIT_ASSERT(s10.empty());
567 UNIT_ASSERT(s10.capacity() >= 100);
568 }
569
570 void TestReplace() {
571 TStringType s(Data._0123456());

Callers

nothing calls this directly

Calls 11

ReserveFunction · 0.85
_0Method · 0.80
_0123456Method · 0.80
_123Method · 0.80
_00000Method · 0.80
_1Method · 0.80
UninitializedFunction · 0.70
sizeMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected