File indexing completed on 2024-04-06 12:13:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <cppunit/extensions/HelperMacros.h>
0011
0012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0013 #include "FWCore/PythonParameterSet/interface/MakePyBind11ParameterSets.h"
0014
0015 #include <memory>
0016
0017 #include <iostream>
0018 #include <sstream>
0019 #include <stdexcept>
0020 #include <string>
0021 #include <vector>
0022
0023 class testreadpsetsfrom : public CppUnit::TestFixture {
0024 CPPUNIT_TEST_SUITE(testreadpsetsfrom);
0025 CPPUNIT_TEST(simpleTest);
0026 CPPUNIT_TEST_SUITE_END();
0027
0028 public:
0029 void setUp() {}
0030 void tearDown() {}
0031 void simpleTest();
0032
0033 private:
0034 };
0035
0036
0037 CPPUNIT_TEST_SUITE_REGISTRATION(testreadpsetsfrom);
0038
0039 void testreadpsetsfrom::simpleTest() {
0040 const char* kTest =
0041 "import FWCore.ParameterSet.Config as cms\n"
0042 "dummy = cms.PSet(b = cms.bool(True))\n"
0043 "foo = cms.PSet(a = cms.string('blah'))\n";
0044 std::shared_ptr<edm::ParameterSet> test = edm::cmspybind11::readPSetsFrom(kTest);
0045
0046 CPPUNIT_ASSERT(test->getParameterSet("dummy").getParameter<bool>("b") == true);
0047 CPPUNIT_ASSERT(test->getParameterSet("foo").getParameter<std::string>("a") == std::string("blah"));
0048 }