xref: /aosp_15_r20/external/armnn/include/armnnTestUtils/PredicateResult.hpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include <sstream>
8 
9 namespace armnn
10 {
11 
12 class PredicateResult
13 {
14 public:
PredicateResult(bool result)15     explicit PredicateResult(bool result)
16         : m_Result(result)
17     {}
18 
PredicateResult(const PredicateResult & predicateResult)19     PredicateResult(const PredicateResult& predicateResult)
20         : m_Result(predicateResult.m_Result)
21         , m_Message(predicateResult.m_Message.str())
22     {}
23 
SetResult(bool newResult)24     void SetResult(bool newResult)
25     {
26         m_Result = newResult;
27     }
28 
Message()29     std::stringstream& Message()
30     {
31         return m_Message;
32     }
33 
operator !() const34     bool operator!() const
35     {
36         return !m_Result;
37     }
38 
operator =(PredicateResult otherPredicateResult)39     void operator=(PredicateResult otherPredicateResult)
40     {
41         otherPredicateResult.m_Result = m_Result;
42     }
43 
44     bool m_Result;
45     std::stringstream m_Message;
46 };
47 
48 }    // namespace armnn