/sparrowhawk/foundation/unit_tests/ESFListTestMain.cpp

http://github.com/jtblatt/duderino · C++ · 75 lines · 41 code · 19 blank · 15 comment · 10 complexity · c4818d8cd0da7424a6e9eefd1b94a253 MD5 · raw file

  1. /*
  2. * Copyright 2005 Joshua Blatt, Yahoo! Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef ESTF_CONCURRENCY_DECORATOR_H
  17. #include <ESTFConcurrencyDecorator.h>
  18. #endif
  19. #ifndef ESTF_REPETITION_DECORATOR_H
  20. #include <ESTFRepetitionDecorator.h>
  21. #endif
  22. #ifndef ESTF_RESULT_COLLECTOR_H
  23. #include <ESTFResultCollector.h>
  24. #endif
  25. #ifndef ESTF_COMPOSITE_H
  26. #include <ESTFComposite.h>
  27. #endif
  28. #ifndef ESTF_ASSERT_H
  29. #include <ESTFAssert.h>
  30. #endif
  31. #ifndef ESF_LIST_TEST_H
  32. #include <ESFListTest.h>
  33. #endif
  34. int main() {
  35. ESFListTestPtr listTest = new ESFListTest();
  36. ESTFConcurrencyDecoratorPtr listDecorator = new ESTFConcurrencyDecorator(listTest, 3);
  37. ESTFCompositePtr testSuite = new ESTFComposite();
  38. testSuite->add(listDecorator);
  39. ESTFRepetitionDecoratorPtr root = new ESTFRepetitionDecorator(testSuite, 3);
  40. ESTFResultCollector collector;
  41. if (false == root->setup()) {
  42. cerr << "Testing framework setup failed" << endl;
  43. return 1;
  44. }
  45. if (false == root->run(&collector)) {
  46. cerr << "Testing framework run failed" << endl;
  47. }
  48. if (false == root->tearDown()) {
  49. cerr << "Testing framework tear down failed" << endl;
  50. }
  51. if (0 == collector.getFailureCount() && 0 == collector.getErrorCount()) {
  52. cout << "All test cases passed" << endl;
  53. }
  54. cout << collector << endl;
  55. return 0;
  56. }