blob: ce67d7c583fcea615c3b45d8fabc8ee77aafea32 [file] [log] [blame]
Jenkins0e205f72019-11-28 16:53:35 +00001/*
2 * Copyright (c) 2016-2019 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 */
Jenkins36ccc902020-02-21 11:10:48 +000024#ifndef VALIDATE_EXAMPLE_H
25#define VALIDATE_EXAMPLE_H
Jenkins0e205f72019-11-28 16:53:35 +000026
27#include "utils/Utils.h"
28namespace arm_compute
29{
30namespace test
31{
32namespace framework
33{
34class Printer;
35} // namespace framework
36} // namespace test
37namespace utils
38{
39/** Abstract ValidateExample class.
40 *
41 * All examples with a validation stage have to inherit from this class.
42 */
43class ValidateExample
44{
45public:
46 /** Setup the example.
47 *
48 * @param[in] argc Argument count.
49 * @param[in] argv Argument values.
50 */
51 virtual bool do_setup(int argc, char **argv)
52 {
53 ARM_COMPUTE_UNUSED(argc, argv);
54 return true;
55 };
56 /** Run the example. */
57 virtual void do_run() {};
58 /** Run reference implementation and validate against the target output
59 */
60 virtual void do_validate()
61 {
62 }
63 /** Teardown the example. */
64 virtual void do_teardown() {};
65 /** Print the example parameters
66 *
67 * @param[in,out] printer Printer to use to print the parameters
68 */
69 virtual void print_parameters(test::framework::Printer &printer)
70 {
71 ARM_COMPUTE_UNUSED(printer);
72 }
73
74 /** Default destructor */
75 virtual ~ValidateExample() = default;
76};
77/** Run an example and handle the potential exceptions it throws
78 *
79 * @param[in] argc Number of command line arguments
80 * @param[in] argv Command line arguments
81 * @param[in] example Example to run
82 */
83int run_example(int argc, char **argv, std::unique_ptr<ValidateExample> example);
84
85} // namespace utils
86} // namespace arm_compute
Jenkins36ccc902020-02-21 11:10:48 +000087#endif /* VALIDATE_EXAMPLE_H */