Test.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. int testIndex(Testing::testIndex_t i)
  31. {
  32. return(i-1);
  33. }
  34. namespace Client
  35. {
  36. TestContainer::TestContainer(Testing::testID_t id):m_containerID(id)
  37. {
  38. }
  39. /* Client */
  40. Suite::Suite(Testing::testID_t id):
  41. TestContainer(id),
  42. m_tests(std::vector<test>()),
  43. m_testIds(std::vector<Testing::testID_t>())
  44. {
  45. }
  46. void Suite::addTest(Testing::testID_t id,test aTest)
  47. {
  48. m_tests.push_back(aTest);
  49. m_testIds.push_back(id);
  50. }
  51. test Suite::getTest(Testing::testIndex_t id)
  52. {
  53. return(m_tests[testIndex(id)]);
  54. }
  55. int Suite::getNbTests()
  56. {
  57. return(m_tests.size());
  58. }
  59. bool Suite::isForcedInCache()
  60. {
  61. return(m_forcedInCache);
  62. }
  63. void Suite::setForceInCache(bool status)
  64. {
  65. m_forcedInCache = status;
  66. }
  67. Group::Group(Testing::testID_t id):
  68. TestContainer(id),
  69. m_groups(std::vector<TestContainer*>())
  70. {
  71. }
  72. void Group::addContainer(TestContainer *s)
  73. {
  74. m_groups.push_back(s);
  75. }
  76. TestContainer *Group::getContainer(Testing::testIndex_t id)
  77. {
  78. return(m_groups[testIndex(id)]);
  79. }
  80. int Group::getNbContainer()
  81. {
  82. return(m_groups.size());
  83. }
  84. }