diff --git a/extensions/extension.h b/extensions/extension.h index bab543a..ad3a847 100644 --- a/extensions/extension.h +++ b/extensions/extension.h @@ -15,10 +15,8 @@ struct SentenceInfo { for (auto info = infoArray; info->name; ++info) // nullptr name marks end of info array if (propertyName == info->name) return info->value; - return *(int*)0xcccc = 0; // gives better error message than alternatives + return *(int*)0xDEAD = 0; // gives better error message than alternatives } - - inline static InfoForExtension DUMMY[2] = { { "text number", 1 } }; }; struct SKIP {}; diff --git a/extensions/removerepeatchar.cpp b/extensions/removerepeatchar.cpp index b1ef8ac..9643a8e 100644 --- a/extensions/removerepeatchar.cpp +++ b/extensions/removerepeatchar.cpp @@ -41,14 +41,16 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) TEST( { + InfoForExtension nonConsole[] = { { "text number", 1 }, {} }; + std::wstring repeatedChars = L"aaaaaaaaaaaabbbbbbcccdddaabbbcccddd"; - ProcessSentence(repeatedChars, { SentenceInfo::DUMMY }); + ProcessSentence(repeatedChars, { nonConsole }); assert(repeatedChars.find(L"aaaabbcd") == 0); std::wstring empty = L"", one = L" ", normal = L"This is a normal sentence. はい"; - ProcessSentence(empty, { SentenceInfo::DUMMY }); - ProcessSentence(one, { SentenceInfo::DUMMY }); - ProcessSentence(normal, { SentenceInfo::DUMMY }); + ProcessSentence(empty, { nonConsole }); + ProcessSentence(one, { nonConsole }); + ProcessSentence(normal, { nonConsole }); assert(empty == L"" && one == L" " && normal == L"This is a normal sentence. はい"); } ); diff --git a/extensions/removerepeatphrase.cpp b/extensions/removerepeatphrase.cpp index 15e20b5..f8af823 100644 --- a/extensions/removerepeatphrase.cpp +++ b/extensions/removerepeatphrase.cpp @@ -77,20 +77,22 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) TEST( { + InfoForExtension nonConsole[] = { { "text number", 1 }, {} }; + std::wstring cyclicRepeats = L"Name: '_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg'"; std::wstring buildupRepeats = L"Name: '__a_ab_abc_abcd_abcde_abcdef_abcdefg'"; std::wstring breakdownRepeats = L"Name: '_abcdefg_abcdef_abcde_abcd_abc_ab_a_'"; - ProcessSentence(cyclicRepeats, { SentenceInfo::DUMMY }); - ProcessSentence(buildupRepeats, { SentenceInfo::DUMMY }); - ProcessSentence(breakdownRepeats, { SentenceInfo::DUMMY }); + ProcessSentence(cyclicRepeats, { nonConsole }); + ProcessSentence(buildupRepeats, { nonConsole }); + ProcessSentence(breakdownRepeats, { nonConsole }); assert(cyclicRepeats == L"Name: '_abcdefg'"); assert(buildupRepeats == L"Name: '_abcdefg'"); assert(breakdownRepeats == L"Name: '_abcdefg'"); std::wstring empty = L"", one = L" ", normal = L"This is a normal sentence. はい"; - ProcessSentence(empty, { SentenceInfo::DUMMY }); - ProcessSentence(one, { SentenceInfo::DUMMY }); - ProcessSentence(normal, { SentenceInfo::DUMMY }); + ProcessSentence(empty, { nonConsole }); + ProcessSentence(one, { nonConsole }); + ProcessSentence(normal, { nonConsole }); assert(empty == L"" && one == L" " && normal == L"This is a normal sentence. はい"); } ); diff --git a/extensions/removerepeatphrase2.cpp b/extensions/removerepeatphrase2.cpp index ce0a42f..ee06f5e 100644 --- a/extensions/removerepeatphrase2.cpp +++ b/extensions/removerepeatphrase2.cpp @@ -35,17 +35,19 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) TEST( { + InfoForExtension nonConsole[] = { { "text number", 1 }, {} }; + std::wstring cyclicRepeats = L"_abcde_abcdef_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg"; std::wstring buildupRepeats = L"__a_ab_abc_abcd_abcde_abcdef_abcdefg"; - ProcessSentence(cyclicRepeats, { SentenceInfo::DUMMY }); - ProcessSentence(buildupRepeats, { SentenceInfo::DUMMY }); + ProcessSentence(cyclicRepeats, { nonConsole }); + ProcessSentence(buildupRepeats, { nonConsole }); assert(cyclicRepeats == L"_abcdefg"); assert(buildupRepeats == L"_abcdefg"); std::wstring empty = L"", one = L" ", normal = L"This is a normal sentence. はい"; - ProcessSentence(empty, { SentenceInfo::DUMMY }); - ProcessSentence(one, { SentenceInfo::DUMMY }); - ProcessSentence(normal, { SentenceInfo::DUMMY }); + ProcessSentence(empty, { nonConsole }); + ProcessSentence(one, { nonConsole }); + ProcessSentence(normal, { nonConsole }); assert(empty == L"" && one == L" " && normal == L"This is a normal sentence. はい"); } );