repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / tests / kits / shared / JsonErrorHandlingTest.h
blob55ca6b1e0636facdc68f6991e4d634989e87e53f
1 /*
2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef JSON_ERROR_HANDLING_TEST_H
6 #define JSON_ERROR_HANDLING_TEST_H
9 #include <TestCase.h>
10 #include <TestSuite.h>
12 #include <DataIO.h>
14 class Sample;
17 class JsonErrorHandlingTest : public CppUnit::TestCase {
18 public:
19 JsonErrorHandlingTest();
20 virtual ~JsonErrorHandlingTest();
22 void TestCompletelyUnknown();
23 void TestObjectWithPrematureSeparator();
25 void TestStringUnterminated();
27 void TestBadStringEscape();
29 void TestBadNumber();
31 void TestIOIssue();
33 static void AddTests(BTestSuite& suite);
34 private:
35 void TestParseWithUnexpectedCharacter(
36 const char* input, int32 line,
37 status_t expectedStatus, char expectedChar);
39 void TestParseWithUnterminatedElement(
40 const char* input, int32 line,
41 status_t expectedStatus);
43 void TestParseWithBadStringEscape(
44 const char* input,
45 int32 line, status_t expectedStatus,
46 char expectedBadEscapeChar);
48 void TestParseWithErrorMessage(
49 const char* input, int32 line,
50 status_t expectedStatus,
51 const char* expectedMessage);
53 void TestParseWithErrorMessage(
54 BDataIO* data, int32 line,
55 status_t expectedStatus,
56 const char* expectedMessage);
61 #endif // JSON_ERROR_HANDLING_TEST_H