Test.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: Test.cpp
  4. * Description: Generic test framework code
  5. *
  6. * $Date: 20. June 2019
  7. * $Revision: V1.0.0
  8. *
  9. * Target Processor: Cortex-M cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #include "Test.h"
  29. #include <cstdio>
  30. #include <iostream>
  31. #include <queue>
  32. int testIndex(Testing::testIndex_t i)
  33. {
  34. return(i-1);
  35. }
  36. namespace Client
  37. {
  38. TestContainer::TestContainer(Testing::testID_t id):m_containerID(id)
  39. {
  40. }
  41. /* Client */
  42. Suite::Suite(Testing::testID_t id):
  43. TestContainer(id),
  44. m_tests(std::vector<test>()),
  45. m_testIds(std::vector<Testing::testID_t>())
  46. {
  47. }
  48. void Suite::addTest(Testing::testID_t id,test aTest)
  49. {
  50. m_tests.push_back(aTest);
  51. m_testIds.push_back(id);
  52. }
  53. test Suite::getTest(Testing::testIndex_t id)
  54. {
  55. return(m_tests[testIndex(id)]);
  56. }
  57. int Suite::getNbTests()
  58. {
  59. return(m_tests.size());
  60. }
  61. bool Suite::isForcedInCache()
  62. {
  63. return(m_forcedInCache);
  64. }
  65. void Suite::setForceInCache(bool status)
  66. {
  67. m_forcedInCache = status;
  68. }
  69. Group::Group(Testing::testID_t id):
  70. TestContainer(id),
  71. m_groups(std::vector<TestContainer*>())
  72. {
  73. }
  74. void Group::addContainer(TestContainer *s)
  75. {
  76. m_groups.push_back(s);
  77. }
  78. TestContainer *Group::getContainer(Testing::testIndex_t id)
  79. {
  80. return(m_groups[testIndex(id)]);
  81. }
  82. int Group::getNbContainer()
  83. {
  84. return(m_groups.size());
  85. }
  86. }