# HG changeset patch # User Christian Urban # Date 1461838389 -3600 # Node ID 4ffa09e337735cd0973a4b9b2e3e4b0742a67a5d # Parent aa4fdba769ea66fc863230a97fdd0656adbe1d59 updated diff -r aa4fdba769ea -r 4ffa09e33773 Literature/Klenex-paper.pdf Binary file Literature/Klenex-paper.pdf has changed diff -r aa4fdba769ea -r 4ffa09e33773 Literature/grathwohl2015thesis.pdf Binary file Literature/grathwohl2015thesis.pdf has changed diff -r aa4fdba769ea -r 4ffa09e33773 progs/cpp/teststrings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/cpp/teststrings.cpp Thu Apr 28 11:13:09 2016 +0100 @@ -0,0 +1,83 @@ +//============================================================================ +// Name : teststrings.cpp +// Author : Lasse Nielson +// +// Description : Generation of Test Strings for Regular Expressions +// +// Compile : g++ -o teststrings teststrings.cpp +//============================================================================ + +#include +#include +#include + +using namespace std; + +string str_email(int n) { + stringstream ss; + for (int i = 0; i < n; ++i) { + for (int j = 0; j < i % 27 + 3; ++j) + ss << (char) ('a' + (j % 26)); + if (n > i + 1) + ss << "-"; + } + ss << "@"; + for (int j = 0; j < 2; ++j) { + for (int i = 0; i < n + 3; ++i) + ss << (char) ('a' + ((i + j) % 26)); + ss << "."; + } + ss << "com"; + return ss.str(); +} + +string str_amount(int n) { + stringstream ss; + ss << "$"; + for (int i = 0; i < n; ++i) { + ss << (1 + i) % 10; + if (n > i + 1 && (n - i) % 3 == 1) + ss << ","; + } + ss << ".53"; + return ss.str(); +} + +string str_float(int n) { + stringstream ss; + ss << "-"; + for (int i = 0; i < n; ++i) { + ss << (1 + i) % 10; + } + ss << "."; + for (int i = 0; i < n; ++i) { + ss << (1 + i) % 10; + } + ss << "E+"; + for (int i = 0; i < n; ++i) { + ss << (1 + i) % 10; + } + return ss.str(); +} + +int main() { + + int fin = 10; + + // emails + for (int i = 1; i < fin; i++) { + cout << str_email(i) << endl; + } + + // dollar amounts + for (int i = 1; i < fin; i++) { + cout << str_amount(i) << endl; + } + + // float numbers + for (int i = 1; i < fin; i++) { + cout << str_float(i) << endl; + } + + return 0; +}