BOOST_FIXTURE_TEST_CASE(test7, base_fixture_t) { TStringList Lines; Lines.SetSorted(true); if (1) { Lines.SetDuplicates(dupAccept); Lines.Add(L"aaa"); Lines.Add(L"aaa"); Lines.Add(L"bbb"); BOOST_CHECK(3 == Lines.GetCount()); BOOST_CHECK(0 == Lines.IndexOf(L"aaa")); BOOST_CHECK(2 == Lines.IndexOf(L"bbb")); } Lines.Clear(); if (1) { Lines.SetDuplicates(dupIgnore); Lines.Add(L"aaa"); Lines.Add(L"aaa"); Lines.Add(L"bbb"); BOOST_CHECK(2 == Lines.GetCount()); BOOST_CHECK(1 == Lines.IndexOf(L"bbb")); } Lines.Clear(); if (1) { Lines.SetDuplicates(dupError); Lines.Add(L"aaa"); Lines.Add(L"bbb"); BOOST_CHECK_THROW(Lines.Add(L"aaa"), std::exception); } }
void TIniFile::WriteStringList(const wxString & Section, const wxString & Ident, TStringList& Value) { EraseSection(Section); for (int i = 0; i < Value.GetCount(); i++) { this->WriteString(Section, wxString::Format("%s%d", Ident, (i)), Value.Item(i)); } }
void SetListBoxItems(wxListBox *lb, TStringList sl) { lb->Clear(); if (sl.GetCount() > 0) { for (size_t i = 0; i < sl.Count(); i++) { wxString st = sl.Item(i); lb->Append(st); } } }
BOOST_FIXTURE_TEST_CASE(test1, base_fixture_t) { if (1) { UnicodeString Text = ::StringOfChar(' ', 4); BOOST_CHECK_EQUAL(" ", W2MB(Text.c_str()).c_str()); } if (1) { UnicodeString Message = L"long long long long long long long long long text"; TStringList MessageLines; int MaxMessageWidth = 20; FarWrapText(Message, &MessageLines, MaxMessageWidth); BOOST_TEST_MESSAGE("MessageLines = " << W2MB(MessageLines.GetText().c_str())); BOOST_CHECK_EQUAL(4, MessageLines.GetCount()); BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(0).c_str()).c_str()); BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(1).c_str()).c_str()); BOOST_CHECK_EQUAL("long long long", W2MB(MessageLines.GetString(2).c_str()).c_str()); BOOST_CHECK_EQUAL("text", W2MB(MessageLines.GetString(3).c_str()).c_str()); } }
} int WINAPI ConfigureW(int item) { DebugAssert(FarPlugin); TFarPluginGuard Guard; return static_cast<int>(FarPlugin->Configure(static_cast<intptr_t>(item))); } HANDLE WINAPI OpenPluginW(int openFrom, intptr_t item) { SELF_TEST( UnicodeString Text = L"text, text text, text text1\ntext text text, text text2\n"; TStringList Lines; Lines.SetCommaText(Text); assert(Lines.GetCount() == 5); UnicodeString Instructions = L"Using keyboard authentication.\x0A\x0A\x0APlease enter your password."; UnicodeString Instructions2 = ReplaceStrAll(Instructions, L"\x0D\x0A", L"\x01"); Instructions2 = ReplaceStrAll(Instructions2, L"\x0A\x0D", L"\x01"); Instructions2 = ReplaceStrAll(Instructions2, L"\x0A", L"\x01"); Instructions2 = ReplaceStrAll(Instructions2, L"\x0D", L"\x01"); Instructions2 = ReplaceStrAll(Instructions2, L"\x01", L"\x0D\x0A"); assert(wcscmp(Instructions2.c_str(), UnicodeString(L"Using keyboard authentication.\x0D\x0A\x0D\x0A\x0D\x0APlease enter your password.").c_str()) == 0); ) DebugAssert(FarPlugin); TFarPluginGuard Guard; return FarPlugin->OpenPlugin(openFrom, item); } void WINAPI ClosePluginW(HANDLE Plugin)