vector_ut.cpp 942 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <library/cpp/testing/unittest/registar.h>
  2. #include "cast.h"
  3. #include "vector.h"
  4. Y_UNIT_TEST_SUITE(TStringJoinTest) {
  5. Y_UNIT_TEST(Test1) {
  6. TVector<TUtf16String> v;
  7. UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring("")), ToWtring(""));
  8. }
  9. Y_UNIT_TEST(Test2) {
  10. TVector<TUtf16String> v;
  11. v.push_back(ToWtring("1"));
  12. v.push_back(ToWtring("2"));
  13. UNIT_ASSERT_EQUAL(JoinStrings(v, ToWtring(" ")), ToWtring("1 2"));
  14. }
  15. Y_UNIT_TEST(Test3) {
  16. TVector<TUtf16String> v;
  17. v.push_back(ToWtring("1"));
  18. v.push_back(ToWtring("2"));
  19. UNIT_ASSERT_EQUAL(JoinStrings(v, 1, 10, ToWtring(" ")), ToWtring("2"));
  20. }
  21. Y_UNIT_TEST(TestJoinWStrings) {
  22. const TUtf16String str = u"Яндекс";
  23. const TVector<TUtf16String> v(1, str);
  24. UNIT_ASSERT_EQUAL(JoinStrings(v, TUtf16String()), str);
  25. }
  26. } // Y_UNIT_TEST_SUITE(TStringJoinTest)