-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[json] improve roottest/io/json testing #18483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,58 @@ | ||
|
||
ROOTTEST_COMPILE_MACRO(test_classes.h FIXTURES_SETUP json-test-classes-build) | ||
ROOTTEST_ADD_AUTOMACROS(FIXTURES_REQUIRED json-test-classes-build) | ||
ROOTTEST_ADD_TEST(ArrayCompress | ||
MACRO runArrayCompress.C | ||
OUTREF ArrayCompress.ref) | ||
|
||
ROOTTEST_ADD_TEST(PolyMarker | ||
MACRO runPolyMarker.C | ||
OUTREF PolyMarker.ref) | ||
|
||
ROOTTEST_GENERATE_DICTIONARY(libJsonTestClasses | ||
test_classes.h | ||
LINKDEF LinkDef.h | ||
NO_ROOTMAP NO_CXXMODULE) | ||
|
||
ROOTTEST_ADD_TEST(BasicTypes | ||
MACRO runBasicTypes.C | ||
OUTREF BasicTypes.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(Objects | ||
MACRO runObjects.C | ||
OUTREF Objects.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(RootClasses | ||
MACRO runRootClasses.C | ||
OUTREF RootClasses.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(STL | ||
MACRO runSTL.C | ||
OUTREF STL.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(STL0 | ||
MACRO runSTL0.C | ||
OUTREF STL0.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(STL1 | ||
MACRO runSTL1.C | ||
OUTREF STL1.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(StreamerLoop | ||
MACRO runStreamerLoop.C | ||
OUTREF StreamerLoop.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(Map | ||
MACRO runMap.C | ||
OUTREF Map.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) | ||
|
||
ROOTTEST_ADD_TEST(String | ||
MACRO runString.C | ||
OUTREF String.ref | ||
DEPENDS ${GENERATE_DICTIONARY_TEST}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifdef __CLING__ | ||
|
||
#pragma link off all globals; | ||
#pragma link off all classes; | ||
#pragma link off all functions; | ||
|
||
#pragma link C++ class std::map<std::string,int>+; | ||
|
||
#pragma link C++ class TJsonEx1+; | ||
#pragma link C++ class TJsonEx2+; | ||
#pragma link C++ class TJsonEx3+; | ||
#pragma link C++ class TJsonEx4+; | ||
#pragma link C++ class TJsonEx5+; | ||
#pragma link C++ class TJsonEx6+; | ||
#pragma link C++ class TJsonEx7+; | ||
#pragma link C++ class TJsonEx8+; | ||
#pragma link C++ class TJsonEx9+; | ||
#pragma link C++ class TJsonEx10+; | ||
#pragma link C++ class TJsonEx11+; | ||
#pragma link C++ class TJsonEx12+; | ||
#pragma link C++ class TJsonEx13+; | ||
#pragma link C++ class TJsonEx14+; | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,33 @@ | ||
{ | ||
// Fill out the code of the actual test | ||
#ifndef SECOND_RUN | ||
gROOT->ProcessLine(".L test_classes.h+"); | ||
#endif | ||
#include "test_classes.h" | ||
|
||
#if defined(ClingWorkAroundMissingDynamicScope) && !defined(SECOND_RUN) | ||
#define SECOND_RUN | ||
gROOT->ProcessLine(".x runBasicTypes.C"); | ||
#else | ||
void runBasicTypes() | ||
{ | ||
gSystem->Load("libJsonTestClasses"); | ||
|
||
TJsonEx1 ex1; ex1.Init(); | ||
TJsonEx2 ex2; ex2.Init(); | ||
TJsonEx3 ex3; ex3.Init(); | ||
TJsonEx11 ex11; ex11.Init(); | ||
TString json; | ||
|
||
cout << " ====== basic data types TJsonEx1 ===== " << endl; | ||
std::cout << " ====== basic data types TJsonEx1 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex1); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== inheritance from TJsonEx1, TJsonEx11 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== inheritance from TJsonEx1, TJsonEx11 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex11); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== arrays of basic data types TJsonEx2 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== arrays of basic data types TJsonEx2 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex2); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== dynamic arrays of basic data types TJsonEx3 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== dynamic arrays of basic data types TJsonEx3 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex3); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ============ selected data members ======== " << endl; | ||
cout << "ex2.fInt = " << TBufferJSON::ToJSON(&ex2, 0, "fInt") << endl; | ||
cout << "ex3.fChar = " << TBufferJSON::ToJSON(&ex3, 0, "fChar") << endl; | ||
cout << "ex3.fLong = " << TBufferJSON::ToJSON(&ex3, 0, "fLong") << endl; | ||
|
||
#endif | ||
#ifdef ClingWorkAroundBrokenUnnamedReturn | ||
gApplication->Terminate(0); | ||
#else | ||
return 0; | ||
#endif | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ============ selected data members ======== " << std::endl; | ||
std::cout << "ex2.fInt = " << TBufferJSON::ToJSON(&ex2, 0, "fInt") << std::endl; | ||
std::cout << "ex3.fChar = " << TBufferJSON::ToJSON(&ex3, 0, "fChar") << std::endl; | ||
std::cout << "ex3.fLong = " << TBufferJSON::ToJSON(&ex3, 0, "fLong") << std::endl; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
{ | ||
// Fill out the code of the actual test | ||
#ifndef SECOND_RUN | ||
gROOT->ProcessLine(".L test_classes.h+"); | ||
#endif | ||
#include "test_classes.h" | ||
|
||
#if defined(ClingWorkAroundMissingDynamicScope) && !defined(SECOND_RUN) | ||
#define SECOND_RUN | ||
gROOT->ProcessLine(".x runObjects.C"); | ||
#else | ||
void runObjects() | ||
{ | ||
gSystem->Load("libJsonTestClasses"); | ||
|
||
TJsonEx5 ex5; ex5.Init(); | ||
TJsonEx6 ex6; ex6.Init(); | ||
TJsonEx10 ex10; ex10.Init(); | ||
TString json; | ||
|
||
cout << " ====== objects as class members TJsonEx5 ===== " << endl; | ||
std::cout << " ====== objects as class members TJsonEx5 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex5); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== arrays of objects as class members TJsonEx6 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== arrays of objects as class members TJsonEx6 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex6); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== ROOT TObject/TNamed/TString as class members TJsonEx10 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== ROOT TObject/TNamed/TString as class members TJsonEx10 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex10); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ============ selected data members ======== " << endl; | ||
cout << "ex5.fObj1 = " << TBufferJSON::ToJSON(&ex5, 0, "fObj1") << endl; | ||
cout << "ex5.fPtr1 = " << TBufferJSON::ToJSON(&ex5, 0, "fPtr1") << endl; | ||
cout << "ex5.fSafePtr1 = " << TBufferJSON::ToJSON(&ex5, 0, "fSafePtr1") << endl; | ||
cout << "ex6.fObj1 = " << TBufferJSON::ToJSON(&ex6, 0, "fObj1") << endl; | ||
|
||
#endif | ||
#ifdef ClingWorkAroundBrokenUnnamedReturn | ||
gApplication->Terminate(0); | ||
#else | ||
return 0; | ||
#endif | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ============ selected data members ======== " << std::endl; | ||
std::cout << "ex5.fObj1 = " << TBufferJSON::ToJSON(&ex5, 0, "fObj1") << std::endl; | ||
std::cout << "ex5.fPtr1 = " << TBufferJSON::ToJSON(&ex5, 0, "fPtr1") << std::endl; | ||
std::cout << "ex5.fSafePtr1 = " << TBufferJSON::ToJSON(&ex5, 0, "fSafePtr1") << std::endl; | ||
std::cout << "ex6.fObj1 = " << TBufferJSON::ToJSON(&ex6, 0, "fObj1") << std::endl; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,29 @@ | ||
{ | ||
// Fill out the code of the actual test | ||
#ifndef SECOND_RUN | ||
gROOT->ProcessLine(".L test_classes.h+"); | ||
#endif | ||
#include "test_classes.h" | ||
|
||
#if defined(ClingWorkAroundMissingDynamicScope) && !defined(SECOND_RUN) | ||
#define SECOND_RUN | ||
gROOT->ProcessLine(".x runSTL.C"); | ||
#else | ||
void runSTL() | ||
{ | ||
gSystem->Load("libJsonTestClasses"); | ||
|
||
TJsonEx7 ex7; ex7.Init(); | ||
TJsonEx8 ex8; ex8.Init(); | ||
TJsonEx12 ex12; ex12.Init(); | ||
TJsonEx13 ex13; ex13.Init(); | ||
TString json; | ||
|
||
cout << " ====== different STL containers TJsonEx7 ===== " << endl; | ||
std::cout << " ====== different STL containers TJsonEx7 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex7); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== STL as base class TJsonEx8 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== STL as base class TJsonEx8 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex8); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== STL vector of complex classes TJsonEx12 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== STL vector of complex classes TJsonEx12 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex12); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
cout << " ====== More exotic STL containers as set or map with TRef inside TJsonEx13 ===== " << endl; | ||
std::cout << json << std::endl << std::endl; | ||
std::cout << " ====== More exotic STL containers as set or map with TRef inside TJsonEx13 ===== " << std::endl; | ||
json = TBufferJSON::ToJSON(&ex13); | ||
testJsonReading(json); | ||
cout << json << endl << endl; | ||
|
||
#endif | ||
#ifdef ClingWorkAroundBrokenUnnamedReturn | ||
gApplication->Terminate(0); | ||
#else | ||
return 0; | ||
#endif | ||
std::cout << json << std::endl << std::endl; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.