TestWriter.hpp
Go to the documentation of this file.
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_TESTING__TEST_WRITER
18 #define COM_BORA_SOFTWARE__BALAU_TESTING__TEST_WRITER
19 
21 #include <Balau/Resource/File.hpp>
22 #include <Balau/Resource/Uri.hpp>
24 #include <Balau/Util/Vectors.hpp>
25 
26 namespace Balau::Testing {
27 
31 class TestWriter {
35  public: virtual ~TestWriter() = default;
36 
42  public: template<typename T> void write(T value) {
44 
45  writeString(toString(value));
46  }
47 
53  public: virtual void writeString(const std::string & value) = 0;
54 
60  public: virtual std::unique_ptr<TestWriter> clone() const = 0;
61 
62  protected: TestWriter() = default;
63 };
64 
65 } // namespace Balau::Testing
66 
67 #endif // COM_BORA_SOFTWARE__BALAU_TESTING__TEST_WRITER
Base class of test writers.
Definition: TestWriter.hpp:31
A file on the local file system.
A write only standard file on a file system which is written as bytes.
Utilities for vectors.
Balau::U8String< AllocatorT > toString(const BalauException &e)
Base class toString<AllocatorT> function for Balau exceptions.
Definition: BalauException.hpp:122
virtual std::unique_ptr< TestWriter > clone() const =0
Clone the writer instance.
virtual ~TestWriter()=default
Destroy a test writer instance.
void write(T value)
Convert the supplied value to a UTF-8 string and write the string to the writer&#39;s output stream(s)...
Definition: TestWriter.hpp:42
Test assertion functions.
virtual void writeString(const std::string &value)=0
Write the supplied UTF-8 string to the writer&#39;s output stream(s).
The test runner and test assertion functions.
Definition: Assertions.hpp:23
Balau::U8String< AllocatorT > toString(ExecutionModel model)
Print the execution model value as a UTF-8 string.
Definition: ExecutionModel.hpp:92
The abstract URI base class.