Skip to content

Commit

Permalink
fix warning about std::endl vs \n
Browse files Browse the repository at this point in the history
  • Loading branch information
dsp56300 committed Nov 24, 2024
1 parent 81e292f commit b81ec90
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions source/virusIntegrationTest/integrationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(int _argc, char* _argv[])
}
catch (const std::string& _err)
{
std::cout << "Unit test failed: " << _err << std::endl;
std::cout << "Unit test failed: " << _err << '\n';
return -1;
}
}
Expand Down Expand Up @@ -71,7 +71,7 @@ int main(int _argc, char* _argv[])

if(subfolders.empty())
{
std::cout << "Nothing found for testing in folder " << cmd.get("folder") << std::endl;
std::cout << "Nothing found for testing in folder " << cmd.get("folder") << '\n';
return -1;
}

Expand All @@ -90,7 +90,7 @@ int main(int _argc, char* _argv[])

if(files.empty())
{
std::cout << "Directory " << subfolder << " doesn't contain any files" << std::endl;
std::cout << "Directory " << subfolder << " doesn't contain any files" << '\n';
return -1;
}

Expand All @@ -110,12 +110,12 @@ int main(int _argc, char* _argv[])

if(romFile.empty())
{
std::cout << "Failed to find ROM in folder " << subfolder << std::endl;
std::cout << "Failed to find ROM in folder " << subfolder << '\n';
return -1;
}
if(presetsFile.empty())
{
std::cout << "Failed to find presets file in folder " << subfolder << std::endl;
std::cout << "Failed to find presets file in folder " << subfolder << '\n';
return -1;
}

Expand All @@ -126,7 +126,7 @@ int main(int _argc, char* _argv[])

if(!ss.is_open())
{
std::cout << "Failed to open presets file " << presetsFile << std::endl;
std::cout << "Failed to open presets file " << presetsFile << '\n';
return -1;
}

Expand All @@ -144,7 +144,7 @@ int main(int _argc, char* _argv[])

if(presets.empty())
{
std::cout << "Presets file " << presetsFile << " is empty" << std::endl;
std::cout << "Presets file " << presetsFile << " is empty" << '\n';
return -1;
}

Expand All @@ -166,12 +166,12 @@ int main(int _argc, char* _argv[])
}
}
}
std::cout << "invalid command line arguments" << std::endl;
std::cout << "invalid command line arguments" << '\n';
return -1;
}
catch(const std::runtime_error& _err)
{
std::cout << _err.what() << std::endl;
std::cout << _err.what() << '\n';
return -1;
}
}
Expand All @@ -189,13 +189,13 @@ int IntegrationTest::run()
{
if (!m_app.isValid())
{
std::cout << "Failed to load ROM " << m_romFile << ", make sure that the ROM file is valid" << std::endl;
std::cout << "Failed to load ROM " << m_romFile << ", make sure that the ROM file is valid" << '\n';
return -1;
}

if (!m_app.loadSingle(m_presetName))
{
std::cout << "Failed to find preset '" << m_presetName << "', make sure to use a ROM that contains it" << std::endl;
std::cout << "Failed to find preset '" << m_presetName << "', make sure to use a ROM that contains it" << '\n';
return -1;
}

Expand All @@ -219,7 +219,7 @@ bool IntegrationTest::loadAudioFile(File& _dst, const std::string& _filename) co
const auto hFile = fopen(_filename.c_str(), "rb");
if (!hFile)
{
std::cout << "Failed to load wav file " << _filename << " for comparison" << std::endl;
std::cout << "Failed to load wav file " << _filename << " for comparison" << '\n';
return false;
}
fseek(hFile, 0, SEEK_END);
Expand All @@ -228,7 +228,7 @@ bool IntegrationTest::loadAudioFile(File& _dst, const std::string& _filename) co
fseek(hFile, 0, SEEK_SET);
if (fread(&_dst.file.front(), 1, size, hFile) != size)
{
std::cout << "Failed to read data from file " << _filename << std::endl;
std::cout << "Failed to read data from file " << _filename << '\n';
fclose(hFile);
return false;
}
Expand All @@ -238,19 +238,19 @@ bool IntegrationTest::loadAudioFile(File& _dst, const std::string& _filename) co

if (!synthLib::WavReader::load(_dst.data, nullptr, &_dst.file.front(), _dst.file.size()))
{
std::cout << "Failed to interpret file " << _filename << " as wave data, make sure that the file is a valid 24 bit stereo wav file" << std::endl;
std::cout << "Failed to interpret file " << _filename << " as wave data, make sure that the file is a valid 24 bit stereo wav file" << '\n';
return false;
}

if(_dst.data.samplerate != m_app.getRom().getSamplerate())
{
std::cout << "Wave file " << _filename << " does not have the correct samplerate, expected " << m_app.getRom().getSamplerate() << " but got " << _dst.data.samplerate << " instead" << std::endl;
std::cout << "Wave file " << _filename << " does not have the correct samplerate, expected " << m_app.getRom().getSamplerate() << " but got " << _dst.data.samplerate << " instead" << '\n';
return false;
}

if (_dst.data.bitsPerSample != 24 || _dst.data.channels != 2 || _dst.data.isFloat)
{
std::cout << "Wave file " << _filename << " has an invalid format, expected 24 bit / 2 channels but got " << _dst.data.bitsPerSample << " bit / " << _dst.data.channels << " channels" << std::endl;
std::cout << "Wave file " << _filename << " has an invalid format, expected 24 bit / 2 channels but got " << _dst.data.bitsPerSample << " bit / " << _dst.data.channels << " channels" << '\n';
return false;
}
return true;
Expand Down Expand Up @@ -278,15 +278,15 @@ int IntegrationTest::runCompare()

if(b != a)
{
std::cout << "Test failed, audio output is not identical to reference file, difference starting at frame " << (i>>1) << ", ROM " << m_romFile << ", preset " << m_presetName << std::endl;
std::cout << "Test failed, audio output is not identical to reference file, difference starting at frame " << (i>>1) << ", ROM " << m_romFile << ", preset " << m_presetName << '\n';
return -2;
}

ptrA += 3;
ptrB += 3;
}

std::cout << "Test succeeded, compared " << sampleCount << " samples, ROM " << m_romFile << ", preset " << m_presetName << std::endl;
std::cout << "Test succeeded, compared " << sampleCount << " samples, ROM " << m_romFile << ", preset " << m_presetName << '\n';
return 0;
}

Expand All @@ -306,7 +306,7 @@ int IntegrationTest::createAudioFile(File& _dst, const std::string& _prefix, con

if(!hFile)
{
std::cout << "Failed to create output file " << filename << std::endl;
std::cout << "Failed to create output file " << filename << '\n';
return -1;
}

Expand All @@ -316,15 +316,15 @@ int IntegrationTest::createAudioFile(File& _dst, const std::string& _prefix, con

if(!loadAudioFile(_dst, filename))
{
std::cout << "Failed to open written file " << filename << " for verification" << std::endl;
std::cout << "Failed to open written file " << filename << " for verification" << '\n';
return -1;
}

const auto sampleCount = _dst.data.dataByteSize * 8 / _dst.data.bitsPerSample / 2;

if(sampleCount != _sampleCount)
{
std::cout << "Verification of written file failed, expected " << _sampleCount << " samples but file only has " << sampleCount << " samples" << std::endl;
std::cout << "Verification of written file failed, expected " << _sampleCount << " samples but file only has " << sampleCount << " samples" << '\n';
return -1;
}
return 0;
Expand Down

0 comments on commit b81ec90

Please sign in to comment.