From 1cbc1877be5a005d9b6bc71e3693b8c9a754ff12 Mon Sep 17 00:00:00 2001 From: Nemanja Trifunovic Date: Fri, 2 Oct 2015 18:56:06 -0400 Subject: [PATCH] Removing various infrastructure files --- buildrelease.pl | 18 ---- test_drivers/performance/Makefile | 5 - test_drivers/performance/iconvtest.cpp | 132 ------------------------- test_drivers/performance/timer.h | 22 ----- test_drivers/performance/win32.cpp | 110 --------------------- test_drivers/runtests.pl | 50 ---------- 6 files changed, 337 deletions(-) delete mode 100644 buildrelease.pl delete mode 100644 test_drivers/performance/Makefile delete mode 100644 test_drivers/performance/iconvtest.cpp delete mode 100644 test_drivers/performance/timer.h delete mode 100644 test_drivers/performance/win32.cpp delete mode 100644 test_drivers/runtests.pl diff --git a/buildrelease.pl b/buildrelease.pl deleted file mode 100644 index ed3a17bbe..000000000 --- a/buildrelease.pl +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/perl - -$release_files = 'source/utf8.h source/utf8/core.h source/utf8/checked.h source/utf8/unchecked.h doc/utf8cpp.html doc/ReleaseNotes'; - -# First get the latest version -`svn update`; - -# Then construct the name of the zip file -$argc = @ARGV; -if ($argc > 0) { - $zip_name = $ARGV[0]; -} -else { - $zip_name = "utf8"; -} - -# Zip the files to an archive -`zip $zip_name $release_files`; diff --git a/test_drivers/performance/Makefile b/test_drivers/performance/Makefile deleted file mode 100644 index b38544506..000000000 --- a/test_drivers/performance/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -CC = g++ -CFLAGS = -O3 - -iconvtest: iconvtest.cpp ../../source/utf8.h timer.h ../../source/utf8/core.h ../../source/utf8/checked.h ../../source/utf8/unchecked.h - $(CC) $(CFLAGS) iconvtest.cpp -oiconvtest diff --git a/test_drivers/performance/iconvtest.cpp b/test_drivers/performance/iconvtest.cpp deleted file mode 100644 index 95e73e747..000000000 --- a/test_drivers/performance/iconvtest.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include -#include -#include "../../source/utf8.h" -#include "timer.h" -#include -#include -#include -using namespace std; - -using namespace utf8; - -int main(int argc, char** argv) -{ - if (argc != 2) { - cout << "\nUsage: iconvtest filename\n"; - return 0; - } - const char* test_file_path = argv[1]; - // Open the test file (UTF-8 encoded text) - ifstream fs8(test_file_path, ios::binary); - if (!fs8.is_open()) { - cout << "Could not open " << test_file_path << endl; - return 0; - } - // get length - fs8.seekg(0, ios::end); - int length = fs8.tellg(); - fs8.seekg(0, ios::beg); - - // allocate the buffer (no vector - we are benchmarking conversions, not STL - char* buf = new char[length]; - char* end_buf = buf + length; - // fill the data - fs8.read(buf, length); - fs8.close(); - // the UTF-16 result will not be larger than this (I hope :) ) - vector temputf16; - utf8::utf8to16(buf, end_buf, back_inserter(temputf16)); - int wlength = temputf16.size(); - unsigned short* utf16buf = new unsigned short[wlength]; - - cout << "UTF8 to UTF-16\n"; - { - memset (utf16buf, 0 , wlength * sizeof(unsigned short)); - // utf-8 cpp: - cout << "utf8::utf8to16: "; - timer t(cout); - utf8::utf8to16(buf, buf + length, utf16buf); - t.print_time(); - } - - { - memset (utf16buf, 0 , wlength * sizeof(unsigned short)); - // utf-8 cpp: - cout << "unchecked::utf8to16: "; - timer t(cout); - utf8::unchecked::utf8to16(buf, buf + length, utf16buf); - t.print_time(); - } - - // the UTF-16 result will not be larger than this (I hope :) ) - unsigned short* utf16iconvbuf = new unsigned short[wlength]; - { - memset (utf16iconvbuf, 0 , wlength * sizeof(unsigned short)); - // iconv - cout << "iconv: "; - - iconv_t cd = iconv_open("UTF-16LE", "UTF-8"); - if (cd == iconv_t(-1)) { - cout << "Error openning the iconv stream"; - return 0; - } - char* inbuf = buf; - size_t in_bytes_left = length; - char* outbuf = (char*)utf16iconvbuf; - size_t out_bytes_left = wlength * sizeof (unsigned short); - { - timer t(cout); - iconv(cd, &inbuf, &in_bytes_left, &outbuf, &out_bytes_left); - t.print_time(); - } - iconv_close(cd); - } - - // just check the correctness while we are here: - if (!equal(utf16buf, utf16buf + wlength, utf16iconvbuf)) - cout << "Different result!!!\n"; - - // the other way around - cout << "UTF16 to UTF-8\n"; - { - //iconv - memset(buf, 0, length); - cout<< "iconv: "; - - iconv_t cd = iconv_open("UTF-8", "UTF-16LE"); - if (cd == iconv_t(-1)) { - cout << "Error openning the iconv stream"; - return 0; - } - char* inbuf = (char*)utf16buf; - size_t in_bytes_left = wlength * sizeof(unsigned short); - char* outbuf =buf; - size_t out_bytes_left = length; - { - timer t(cout); - iconv(cd, &inbuf, &in_bytes_left, &outbuf, &out_bytes_left); - t.print_time(); - } - iconv_close(cd); - } - - { - memset (buf, 0 , length); - // utf-8 cpp: - cout << "unchecked::utf16to8: "; - timer t(cout); - utf8::unchecked::utf16to8(utf16buf, utf16buf + wlength, buf); - t.print_time(); - } - - { - memset (buf, 0 , length); - cout << "utf16to8: "; - timer t(cout); - utf8::utf16to8(utf16buf, utf16buf + wlength, buf); - t.print_time(); - } - - delete [] buf; - delete [] utf16buf; -} diff --git a/test_drivers/performance/timer.h b/test_drivers/performance/timer.h deleted file mode 100644 index 807752317..000000000 --- a/test_drivers/performance/timer.h +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -struct timer { - timer(std::ostream& report) : report(report) - {start = std::clock();} - - void print_time() - { - using namespace std; - clock_t now = clock(); - unsigned milliseconds = (now - start)*1000 / CLOCKS_PER_SEC; - report << "Spent " << milliseconds << "ms here\n"; - } - - std::clock_t start; - std::ostream& report; - -private: - // just to surpress a VC++ 8.0 warning - timer& operator = (const timer&); - timer(const timer&); -}; diff --git a/test_drivers/performance/win32.cpp b/test_drivers/performance/win32.cpp deleted file mode 100644 index 3ec861a26..000000000 --- a/test_drivers/performance/win32.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include -#include "../../source/utf8.h" -#include "timer.h" -#include -#include -#include -using namespace std; - -using namespace utf8; - -int main(int argc, char** argv) -{ - if (argc != 2) { - cout << "\nUsage: win32test filename\n"; - return 0; - } - const char* test_file_path = argv[1]; - // Open the test file (UTF-8 encoded text) - ifstream fs8(test_file_path, ios::binary); - if (!fs8.is_open()) { - cout << "Could not open " << test_file_path << endl; - return 0; - } - // get length - fs8.seekg(0, ios::end); - int length = fs8.tellg(); - fs8.seekg(0, ios::beg); - - // allocate the buffer (no vector - we are benchmarking conversions, not STL - char* buf = new char[length]; - // fill the data - fs8.read(buf, length); - fs8.close(); - cout << "UTF8 > UTF16\n"; - // the UTF-16 result will not be larger than this (I hope :) ) - vector temputf16; - utf8::utf8to16(buf, buf + length, back_inserter(temputf16)); - vector::size_type wlength = temputf16.size(); - wchar_t* utf16buf = new wchar_t[wlength]; - - { - memset (utf16buf, 0 , wlength * sizeof(wchar_t)); - // utf-8 cpp: - cout << "utf8::utf8to16: "; - timer t(cout); - utf8::utf8to16(buf, buf + length, utf16buf); - t.print_time(); - } - - { - memset (utf16buf, 0 , wlength * sizeof(wchar_t)); - // utf-8 cpp: - cout << "unchecked::utf8to16: "; - timer t(cout); - utf8::unchecked::utf8to16(buf, buf + length, utf16buf); - t.print_time(); - } - // the UTF-16 result will not be larger than this (I hope :) ) - wchar_t* utf16iconvbuf = new wchar_t[wlength]; - { - memset (utf16iconvbuf, 0 , wlength * sizeof(wchar_t)); - // win32 - cout << "win32: "; - - { - timer t(cout); - MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, buf, length, utf16iconvbuf, int(wlength)); - t.print_time(); - } - - } - - // just check the correctness while we are here: - if (!equal(utf16buf, utf16buf + wlength, utf16iconvbuf)) - cout << "Different result!!!"; - - // the other way around - cout << "UTF16 to UTF-8\n"; - { - //win32 - memset(buf, 0, length); - cout<< "win32: "; - - { - timer t(cout); - WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, utf16buf, int(wlength), buf, length, NULL, NULL); - t.print_time(); - } - } - - { - memset (buf, 0 , length); - // utf-8 cpp: - cout << "unchecked::utf16to8: "; - timer t(cout); - utf8::unchecked::utf16to8(utf16buf, utf16buf + wlength, buf); - t.print_time(); - } - - { - memset (buf, 0 , length); - cout << "utf16to8: "; - timer t(cout); - utf8::utf16to8(utf16buf, utf16buf + wlength, buf); - t.print_time(); - } - - delete [] buf; - delete [] utf16buf; -} diff --git a/test_drivers/runtests.pl b/test_drivers/runtests.pl deleted file mode 100644 index 7d63f1843..000000000 --- a/test_drivers/runtests.pl +++ /dev/null @@ -1,50 +0,0 @@ -#! /usr/bin/perl - -$report_name = './report.txt'; - -# Create the report file -die if !open(REPORT, ">$report_name"); - -# First, build everything -print REPORT "==================Make output==================\n"; -close($report_name); - -`make >> $report_name`; -die if !open(REPORT, ">>$report_name"); -print REPORT "==================End of Make output==================\n"; -print REPORT "\n"; -# Now, run individual tests and create the report -print REPORT "==================Smoke Test ==================\n"; -close($report_name); -chdir 'smoke_test'; -`./smoketest >> ../$report_name`; -chdir '..'; -die if !open(REPORT, ">>$report_name"); -print REPORT "==================End of smoke test==================\n"; -print REPORT "\n"; -print REPORT "==================Regression Test ==================\n"; -close($report_name); -chdir 'regression_tests'; -`./regressiontest >> ../$report_name`; -chdir '..'; -die if !open(REPORT, ">>$report_name"); -print REPORT "==================End of regression test==================\n"; -print REPORT "\n"; -print REPORT "==================Negative Test ==================\n"; -close($report_name); -chdir 'negative'; -`./negative ../../test_data/negative/utf8_invalid.txt >> ../$report_name`; -chdir '..'; -die if !open(REPORT, ">>$report_name"); -print REPORT "==================End of negative test==================\n"; -print REPORT "\n"; -print REPORT "==================utf8reader runs ==================\n"; -close($report_name); -chdir 'utf8reader'; -`./utf8reader ../../test_data/utf8samples/quickbrown.txt >> ../$report_name`; -`./utf8reader ../../test_data/utf8samples/Unicode_transcriptions.html >> ../$report_name`; -`./utf8reader ../../test_data/utf8samples/UTF-8-demo.txt >> ../$report_name`; -chdir '..'; -die if !open(REPORT, ">>$report_name"); -print REPORT "==================End of utf8reader runs==================\n"; -print REPORT "\n";