Nav apraksta

main.cpp 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include <QApplication>
  2. #include "mainwindow.h"
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include "functions.h"
  6. #include <cassert>
  7. #include <QDebug>
  8. #include <QDesktopWidget>
  9. void testSort() {
  10. QString a = "AAA" , b = "BBB" , c = "CCC";
  11. mySortBeta(a,b,c);
  12. assert( a < b && b < c);
  13. a = "AAA", b = "CCC", c = "BBB";
  14. mySortBeta(a,b,c);
  15. assert( a < b && b < c);
  16. a = "BBB", b = "AAA", c = "CCC";
  17. mySortBeta(a,b,c);
  18. assert( a < b && b < c);
  19. a = "BBB", b = "CCC", c = "AAA";
  20. mySortBeta(a,b,c);
  21. assert( a < b && b < c);
  22. a = "CCC", b = "AAA", c = "BBB";
  23. mySortBeta(a,b,c);
  24. //qDebug() << a << b << c;
  25. assert( a < b && b < c);
  26. a = "CCC", b = "BBB", c = "AAA";
  27. mySortBeta(a,b,c);
  28. assert( a < b && b < c);
  29. qDebug() << "Passed Test for Sort!!!!";
  30. }
  31. void testCheck() {
  32. assert( checkWAlpha(91) == QString("ninety one"));
  33. assert( checkWAlpha(891) == QString("eight hundred ninety one"));
  34. assert( checkWAlpha(100) == QString("one hundred"));
  35. assert( checkWAlpha(59123) == QString("fifty nine thousand one hundred twenty three"));
  36. assert( checkWAlpha(100001) == QString("one hundred thousand one"));
  37. assert( checkWAlpha(100000) == QString("one hundred thousand"));
  38. assert( checkWAlpha(100000000) == QString("one hundred million"));
  39. qDebug() << "Passed Test for Check Word!!!!";
  40. }
  41. int main(int argc, char *argv[])
  42. {
  43. // testSort();
  44. initCheckWMaps(); /*** DONT FORGET ***/
  45. // testCheck();
  46. // qDebug() << checkWAlpha(91);
  47. // qDebug() << checkWAlpha(891);
  48. // qDebug() << checkWAlpha(801);
  49. srand(time(NULL));
  50. QApplication a(argc, argv);
  51. MainWindow w;
  52. QDesktopWidget desktop;
  53. int screenWidth, screenHeight;
  54. screenWidth = desktop.screenGeometry().width();
  55. screenHeight = desktop.screenGeometry().height();
  56. w.move( ( screenWidth - w.width() )/2, ( screenHeight- w.height() ) /2);
  57. w.show();
  58. return a.exec();
  59. }