blob: 5d53a16effbd643231d53fcab0e91f19e857e8cc [file] [log] [blame]
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +00001/*
2 * Copyright (c) 2023 Arm Limited.
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
Gian Marco Iodiceebfdb5a2023-07-07 11:25:57 +010025#include "tests/CLConstantTileTest.hpp"
Gunes Bayirab0b7502023-07-11 14:57:36 +010026#include "tests/CLKernelWriterCommentTest.h"
27#include "tests/CLKernelWriterDeclareTileTest.h"
Gian Marco Iodiceebfdb5a2023-07-07 11:25:57 +010028#include "tests/CLTensorArgumentTest.h"
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +000029#include "tests/CLTileTest.hpp"
Gian Marco Iodiceebfdb5a2023-07-07 11:25:57 +010030#include "tests/TensorBitMaskTest.h"
31#include "tests/UtilsTest.h"
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +000032
33#include <memory>
34#include <vector>
35
36using namespace ckw;
37
38/** Main test program
39 */
40int32_t main()
41{
Nikolaj Jensenacea4072023-07-03 09:44:42 +010042 std::vector<ITest *> tests;
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +000043
44 // Add your test here
45 const auto test0 = std::make_unique<UtilsTest>();
46 const auto test1 = std::make_unique<TensorBitMaskTrueTest>();
47 const auto test2 = std::make_unique<TensorBitMaskFalseTest>();
Jakub Sujakdf5d9872023-05-22 17:38:56 +010048 tests.push_back(test0.get());
49 tests.push_back(test1.get());
50 tests.push_back(test2.get());
51
52#ifdef COMPUTE_KERNEL_WRITER_OPENCL_ENABLED
Nikolaj Jensenacea4072023-07-03 09:44:42 +010053 const auto test3 = std::make_unique<CLTileInternalVariableNamesTest>();
54 const auto test4 = std::make_unique<CLTileInternalNumVariablesTest>();
55 const auto test5 = std::make_unique<CLTileAccessScalarVariableTest>();
56 const auto test6 = std::make_unique<CLTileAccessScalarVariableBroadcastXTest>();
57 const auto test7 = std::make_unique<CLTileAccessScalarVariableBroadcastYTest>();
58 const auto test8 = std::make_unique<CLTileAccessVectorVariablesTest>();
59 const auto test9 = std::make_unique<CLTileAccessSubVectorVariablesTest>();
Gian Marco Iodice68e9c4d2023-06-15 17:40:28 +010060 const auto test10 = std::make_unique<CLConstantTileInternalValuesTest>();
61 const auto test11 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastXTest>();
62 const auto test12 = std::make_unique<CLConstantTileAccessScalarVariableBroadcastYTest>();
63 const auto test13 = std::make_unique<CLConstantTileAccessVectorVariablesTest>();
64 const auto test14 = std::make_unique<CLConstantTileAccessSubVectorVariablesTest>();
Gunes Bayirab0b7502023-07-11 14:57:36 +010065#ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED
Viet-Hoa Do3389f532023-07-05 17:36:40 +010066 const auto test15 = std::make_unique<CLKernelWriterCommentTest>();
Gunes Bayirab0b7502023-07-11 14:57:36 +010067#endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */
68 const auto test16 = std::make_unique<CLKernelWriterDeclareTileTest>();
Gian Marco Iodiceebfdb5a2023-07-07 11:25:57 +010069 const auto test17 = std::make_unique<CLTensorArgumentComponentNamesTest>();
70 const auto test18 = std::make_unique<CLTensorArgumentStorageNamesTest>();
71 const auto test19 = std::make_unique<CLTensorArgumentComponentValuesTest>();
72 const auto test20 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueFalseTest>();
73 const auto test21 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueTrueTest>();
74 const auto test22 = std::make_unique<CLTensorArgumentStoragesUsedTest>();
75 const auto test23 = std::make_unique<CLTensorArgumentComponentsUsedPassByValueTrueDynamicDimTrueTest>();
Gian Marco Iodice68e9c4d2023-06-15 17:40:28 +010076
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +000077 tests.push_back(test3.get());
78 tests.push_back(test4.get());
79 tests.push_back(test5.get());
80 tests.push_back(test6.get());
81 tests.push_back(test7.get());
Gian Marco Iodice68e9c4d2023-06-15 17:40:28 +010082 tests.push_back(test8.get());
83 tests.push_back(test9.get());
84 tests.push_back(test10.get());
85 tests.push_back(test11.get());
86 tests.push_back(test12.get());
87 tests.push_back(test13.get());
88 tests.push_back(test14.get());
Gunes Bayirab0b7502023-07-11 14:57:36 +010089#ifdef COMPUTE_KERNEL_WRITER_DEBUG_ENABLED
Viet-Hoa Do3389f532023-07-05 17:36:40 +010090 tests.push_back(test15.get());
Gunes Bayirab0b7502023-07-11 14:57:36 +010091#endif /* COMPUTE_KERNEL_WRITER_DEBUG_ENABLED */
92 tests.push_back(test16.get());
Gian Marco Iodiceebfdb5a2023-07-07 11:25:57 +010093 tests.push_back(test17.get());
94 tests.push_back(test18.get());
95 tests.push_back(test19.get());
96 tests.push_back(test20.get());
97 tests.push_back(test21.get());
98 tests.push_back(test22.get());
99 tests.push_back(test23.get());
Jakub Sujakdf5d9872023-05-22 17:38:56 +0100100#endif /* COMPUTE_KERNEL_WRITER_OPENCL_ENABLED */
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +0000101
102 bool all_test_passed = true;
103
104 for(auto &x : tests)
105 {
106 std::cout << x->name() << std::endl;
107 all_test_passed &= x->run();
108 }
109
110 if(all_test_passed == true)
111 {
112 std::cout << "All tests passed" << std::endl;
113 }
114 else
115 {
Viet-Hoa Do7644b912023-06-29 13:56:17 +0100116 throw std::runtime_error("One or more tests failed");
Gian Marco Iodice6c113ed2023-01-19 17:14:26 +0000117 }
118
119 return 0;
120}