swgen.cpp 743 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Outputs random token.
  3. *
  4. * Token contains latin letters and digits and have length
  5. * between 1 and 1000 characters, inclusive.
  6. *
  7. * To generate different values, call "swgen.exe <weight>".
  8. * See "iwgen.cpp" and "wnext()" documentation for details.
  9. * For example, "swgen.exe -1000" generates short strings and "swgen.exe 1000"
  10. * generates long strings.
  11. *
  12. * It is typical behaviour of testlib generator to setup randseed by command line.
  13. */
  14. #include "testlib.h"
  15. #include <iostream>
  16. using namespace std;
  17. int main(int argc, char* argv[])
  18. {
  19. registerGen(argc, argv, 1);
  20. int length = rnd.wnext(1, 1000, opt<int>(1));
  21. cout << rnd.next("[a-zA-Z0-9]{1,%d}", length) << endl;
  22. return 0;
  23. }