tntnikitik
New member
Короче, в чем дело: есть прога на C++, в которой реализовано шифрование и дешифрование русского текста шифром Виженера. Модуля всего три - заголовочник класса modAlphaCipher, его реализация и собственно main. Код прикреплю ниже, в т.ч юнит-тесты и Makefile. Теперь к сути:
1) Желтое - валится с ошибкой (на скрине), красное проходится
2) Красное - валится с ошибкой на скрине, желтое - ошибка компиляции, если компилировать в IDE, то открывается файл из либы UnitTest++ с кучей ошибок там (прикреплю отдельно код ошибки)
Код:
Почему не работают тесты - так и не смог понять, надеюсь на помощь
1) Желтое - валится с ошибкой (на скрине), красное проходится
2) Красное - валится с ошибкой на скрине, желтое - ошибка компиляции, если компилировать в IDE, то открывается файл из либы UnitTest++ с кучей ошибок там (прикреплю отдельно код ошибки)
Код:
C++:
#pragma once
#include <vector>
#include <string>
#include <map>
#include <locale>
#include <iostream>
#include <codecvt>
class modAlphaCipher
{
private:
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> codec;
std::wstring numAlpha = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ";
std::map <char,int> alphaNum; //ассоциативный массив "номер по символу"
std::vector <int> key; //ключ
std::vector<int> convert(const std::wstring& s); //преобразование строка-вектор
std::wstring convert(const std::vector<int>& v); //преобразование вектор-строка
std::wstring getValidKey(const std::wstring & s);
public:
modAlphaCipher()=delete;
modAlphaCipher(const std::wstring& skey); //конструктор для установки ключа
std::wstring encrypt(const std::wstring& open_text); //зашифрование
std::wstring decrypt(const std::wstring& cipher_text);//расшифрование
std::wstring toValid(std::wstring& s);
};
class cipher_error: public std::invalid_argument
{
public:
explicit cipher_error (const std::string& what_arg):
std::invalid_argument(what_arg) {}
explicit cipher_error (const char* what_arg):
std::invalid_argument(what_arg) {}
};
C++:
#include "headers/modAlphaCipher.h"
#include <vector>
#include <locale>
modAlphaCipher::modAlphaCipher(const std::wstring& skey)
{
for (unsigned i=0; i<numAlpha.size(); i++) {
alphaNum[numAlpha[i]]=i;
}
key = convert(getValidKey(skey));
}
std::wstring modAlphaCipher::encrypt(const std::wstring& open_text)
{
std::vector<int> work = convert(open_text);
for(unsigned i=0; i < work.size(); i++) {
work[i] = (work[i] + key[i % key.size()]) % alphaNum.size();
}
return convert(work);
}
std::wstring modAlphaCipher::decrypt(const std::wstring& cipher_text)
{
std::vector<int> work = convert(cipher_text);
for(unsigned i=0; i < work.size(); i++) {
work[i] = (work[i] + alphaNum.size() - key[i % key.size()]) % alphaNum.size();
}
return convert(work);
}
inline std::vector<int> modAlphaCipher::convert(const std::wstring& s)
{
std::vector<int> result;
for(auto c:s) {
result.push_back(alphaNum[c]);
}
return result;
}
inline std::wstring modAlphaCipher::convert(const std::vector<int>& v)
{
std::wstring result;
for(auto i:v) {
result.push_back(numAlpha[i]);
}
return result;
}
inline std::wstring modAlphaCipher::getValidKey(const std::wstring & s)
{
if (s.empty())
throw cipher_error("Empty key");
//std::wstring tmp = codec.to_bytes(s);
std::wstring tmp(s);
for (auto & c:tmp) {
if (!iswalpha(c))
throw cipher_error("Invalid key");
if (iswlower(c))
c = toupper(c);
}
return tmp;
}
std::wstring modAlphaCipher::toValid(std::wstring& s)
{
//setup converter
using convert_type = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_type, wchar_t> converter;
if (s.empty())
throw cipher_error("Empty text");
//use converter (.to_bytes: wstr->str, .from_bytes: str->wstr)
std::wstring tmp(s);
std::string st = converter.to_bytes(s);
for (auto & c:tmp) {
if (!iswalpha(c))
throw cipher_error(("Text has invalid symbols: ") +st);
if (iswlower(c))
c = towupper(c);
}
return tmp;
}
C++:
#include <iostream>
#include <cctype>
#include "headers/modAlphaCipher.h"
#include <locale>
using namespace std;
std::wstring toValid(std::wstring& s)
{
//setup converter
using convert_type = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_type, wchar_t> converter;
if (s.empty())
throw cipher_error("Empty text");
//use converter (.to_bytes: wstr->str, .from_bytes: str->wstr)
std::wstring tmp(s);
std::string st = converter.to_bytes(s);
for (auto & c:tmp) {
if (!iswalpha(c))
throw cipher_error(("Text has invalid symbols: ") +st);
if (iswlower(c))
c = towupper(c);
}
return tmp;
}
int main(int argc, char **argv)
{
locale loc("ru_RU.UTF-8");
locale::global(loc);
wstring key;
wstring text;
unsigned op;
try {
wcout<<"Cipher ready. Input key: ";
wcin>>key;
//std::wstring vkey=toValid(key);
wcout<<"Key loaded\n";
modAlphaCipher cipher(key);
do {
wcout<<"Cipher ready. Input operation (0-exit, 1-encrypt, 2-decrypt): ";
wcin>>op;
if (op > 2) {
throw cipher_error("Illegal operation\n");
} else if (op >0) {
wcout<<"Cipher ready. Input text: ";
wcin>>text;
std::wstring vtext=cipher.toValid(text);
if (op==1) {
wcout<<"Encrypted text: "<<cipher.encrypt(vtext)<<endl;
} else {
wcout<<"Decrypted text: "<<cipher.decrypt(vtext)<<endl;
}
}
} while (op!=0);
} catch (const cipher_error& e) {
cerr << "Error: " << e.what() << endl;
return 1;
} catch (const exception& e) {
cerr << "Exception: " << e.what() << endl;
return 1;
}
//return 0;
}
C++:
#include <UnitTest++/UnitTest++.h>
#include "headers/modAlphaCipher.h"
#include <iostream>
#include <locale>
#include <codecvt>
using namespace std;
struct KeyAB_fixture {
modAlphaCipher * pointer;
KeyAB_fixture()
{
pointer = new modAlphaCipher(L"АБ");
}
~KeyAB_fixture()
{
delete pointer;
}
};
SUITE(KeyTest)
{
/*TEST(LargeLetters) {
modAlphaCipher test(L"КОТЕЛ");
CHECK(true);
}
TEST(LargeAndSmallLetters) {
modAlphaCipher test(L"КОТопес");
CHECK(true);
}*/
TEST(EmptyKey) {
CHECK_THROW(modAlphaCipher test(L""), cipher_error);
}
TEST(Key_with_a_space) {
CHECK_THROW(modAlphaCipher test(L"кото пес"), cipher_error);
}
TEST(Key_with_invalid_characters_number) {
CHECK_THROW(modAlphaCipher test(L"кото2пес"), cipher_error);
}
TEST(Key_with_invalid_characters_special_character) {
CHECK_THROW(modAlphaCipher test(L"кото.пес"), cipher_error);
}
}
/*SUITE(EncryptTest)
{
TEST_FIXTURE(KeyAB_fixture, LargeLetters) {
CHECK_EQUAL(L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ", pointer->encrypt(L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"));
}
TEST_FIXTURE(KeyAB_fixture, SmallLetters) {
CHECK_EQUAL(L"АГВЕДЖЁИЗКЙМЛОНРПТСФУЦХШЧЪЩЬЫЮЭАЯ", pointer->encrypt(L"абвгдеёжзийклмнопрстуфхцчшщъыьэюя"));
}
TEST_FIXTURE(KeyAB_fixture,NumberInText) {
wstring open_text = L"кора324мох";
CHECK_THROW(pointer->encrypt(open_text),cipher_error);
}
TEST_FIXTURE(KeyAB_fixture,TextWithSpecialSymbol) {
wstring open_text = L"кора/мох";
CHECK_THROW(pointer->encrypt(open_text),cipher_error);
}
TEST_FIXTURE(KeyAB_fixture,TextWithASpace) {
wstring open_text = L"кора мох";
CHECK_THROW(pointer->encrypt(open_text),cipher_error);
}
}*/
SUITE(DecryptTest)
{
TEST_FIXTURE(KeyAB_fixture, LargeLetters) {
wstring cipher_text = L"АГВЕДЖЁИЗКЙМЛОНРПТСФУЦХШЧЪЩЬЫЮЭАЯ";
wstring result_correct = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
CHECK_EQUAL(true, result_correct == pointer->decrypt(cipher_text));
}
TEST_FIXTURE(KeyAB_fixture, Smallletters) {
wstring cipher_text = L"агведжёизкймлонрптсфуцхшчъщьыюэая";
wstring result_correct = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
CHECK_EQUAL(true, result_correct == pointer->decrypt(cipher_text));
}
TEST_FIXTURE(KeyAB_fixture,LargeAndSmallLetters) {
wstring cipher_text = L"ЗДраВстуЙТЕ";
wstring result_correct = L"ЗВРЮВПТСЙРЕ";
CHECK_EQUAL(true, result_correct == pointer->decrypt(cipher_text));
}
}
/*TEST_FIXTURE(KeyAB_fixture, EmptyText) {
wstring cipher_text = L"";
CHECK_THROW(pointer->decrypt(cipher_text),cipher_error);
}
TEST_FIXTURE(KeyAB_fixture,TextWithNumber) {
wstring cipher_text = L"кора324мох";
CHECK_THROW(pointer->decrypt(cipher_text),cipher_error);
}
TEST_FIXTURE(KeyAB_fixture,TextWithSymbol) {
wstring cipher_text = L"кора/мох";
CHECK_THROW(pointer->decrypt(cipher_text),cipher_error);
}
TEST_FIXTURE(KeyAB_fixture,TextWithASpace) {
wstring cipher_text = L"Зкора мох";
CHECK_THROW(pointer->decrypt(cipher_text),cipher_error);
}
}*/
int main(int argc, char **argv)
{
return UnitTest::RunAllTests();
}
Код с оформлением (BB-коды):
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h: In instantiation of ‘void UnitTest::CheckEqual(UnitTest::TestResults&, const Expected&, const Actual&, const UnitTest::TestDetails&) [with Expected = wchar_t [34]; Actual = std::__cxx11::basic_string<wchar_t>]’:
unittest.cpp:46:9: required from here
/usr/include/UnitTest++/Checks.h:24:59: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const std::__cxx11::basic_string<wchar_t>’)
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:108:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/10/ostream:108:36: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)’ {aka ‘std::basic_ostream<char>& (*)(std::basic_ostream<char>&)’}
108 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ostream:117:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]’
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/10/ostream:117:32: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)’ {aka ‘std::basic_ios<char>& (*)(std::basic_ios<char>&)’}
117 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/10/ostream:127:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/10/ostream:127:30: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘std::ios_base& (*)(std::ios_base&)’
127 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/10/ostream:166:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
166 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:166:23: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘long int’
166 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/10/ostream:170:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
170 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:170:32: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘long unsigned int’
170 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/10/ostream:174:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
174 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:174:23: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘bool’
174 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/10/ostream:784,
from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/bits/ostream.tcc:91:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]’
91 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/ostream.tcc:92:22: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘short int’
92 | operator<<(short __n)
| ~~~~~~^~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:181:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
181 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:181:33: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘short unsigned int’
181 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/ostream:784,
from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/bits/ostream.tcc:105:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]’
105 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/ostream.tcc:106:20: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘int’
106 | operator<<(int __n)
| ~~~~^~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:192:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
192 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:192:31: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘unsigned int’
192 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/10/ostream:201:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
201 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:201:28: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘long long int’
201 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/10/ostream:205:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
205 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/10/ostream:205:37: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘long long unsigned int’
205 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/ostream:220:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
220 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/10/ostream:220:25: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘double’
220 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/10/ostream:224:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
224 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/10/ostream:224:24: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘float’
224 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/10/ostream:232:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
232 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/10/ostream:232:30: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘long double’
232 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/10/ostream:245:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]’
245 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/10/ostream:245:30: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘const void*’
245 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/ostream:784,
from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/bits/ostream.tcc:119:5: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]’
119 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/ostream.tcc:120:34: note: no known conversion for argument 1 from ‘const std::__cxx11::basic_string<wchar_t>’ to ‘std::basic_ostream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’}
120 | operator<<(__streambuf_type* __sbin)
| ~~~~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/10/string:55,
from /usr/include/c++/10/bits/locale_classes.h:40,
from /usr/include/c++/10/bits/ios_base.h:41,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/istream:38,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/bits/basic_string.h:6468:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)’
6468 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/10/bits/basic_string.h:6468:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘wchar_t’)
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/bits/ios_base.h:46,
from /usr/include/c++/10/ios:42,
from /usr/include/c++/10/istream:38,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/system_error:262:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::error_code&)’
262 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/10/system_error:262:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘const std::error_code&’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:506:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, _CharT)’
506 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/10/ostream:506:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: deduced conflicting types for parameter ‘_CharT’ (‘char’ and ‘std::__cxx11::basic_string<wchar_t>’)
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:511:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, char)’
511 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/10/ostream:511:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘char’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:517:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, char)’
517 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/10/ostream:517:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘char’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:523:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, signed char)’
523 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/10/ostream:523:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘signed char’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:528:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, unsigned char)’
528 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/10/ostream:528:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘unsigned char’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:589:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const _CharT*)’
589 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/10/ostream:589:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: mismatched types ‘const _CharT*’ and ‘std::__cxx11::basic_string<wchar_t>’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/ostream:784,
from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/bits/ostream.tcc:321:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*)’
321 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/10/bits/ostream.tcc:321:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘const char*’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:606:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*)’
606 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/10/ostream:606:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘const char*’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:619:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*)’
619 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/10/ostream:619:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘const signed char*’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:624:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*)’
624 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/10/ostream:624:5: note: template argument deduction/substitution failed:
In file included from /usr/include/UnitTest++/CheckMacros.h:6,
from /usr/include/UnitTest++/UnitTestPP.h:6,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/UnitTest++/Checks.h:24:59: note: cannot convert ‘actual’ (type ‘const std::__cxx11::basic_string<wchar_t>’) to type ‘const unsigned char*’
24 | stream << "Expected " << expected << " but was " << actual;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/10/istream:39,
from /usr/include/c++/10/sstream:38,
from /usr/include/UnitTest++/MemoryOutStream.h:9,
from /usr/include/UnitTest++/ExecuteTest.h:8,
from /usr/include/UnitTest++/TestMacros.h:7,
from /usr/include/UnitTest++/UnitTestPP.h:5,
from /usr/include/UnitTest++/UnitTest++.h:1,
from unittest.cpp:1:
/usr/include/c++/10/ostream:773:5: note: candidate: ‘template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type>::type std::operator<<(_Ostream&&, const _Tp&)’
773 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/10/ostream:773:5: note: template argument deduction/substitution failed:
/usr/include/c++/10/ostream: In substitution of ‘template<class _Ostream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_ostream<_Ostream>, std::__is_insertable<typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type, const _Tp&, void> >::value, typename std::__is_convertible_to_basic_ostream<_Tp>::__ostream_type>::type std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_string<wchar_t>]’:
/usr/include/UnitTest++/Checks.h:24:59: required from ‘void UnitTest::CheckEqual(UnitTest::TestResults&, const Expected&, const Actual&, const UnitTest::TestDetails&) [with Expected = wchar_t [34]; Actual = std::__cxx11::basic_string<wchar_t>]’
unittest.cpp:46:9: required from here
/usr/include/c++/10/ostream:773:5: error: no type named ‘type’ in ‘struct std::enable_if<false, std::basic_ostream<char>&>’
make: *** [Makefile:13: UnitTest] Ошибка 1