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