2 * Copyright 2001-2007 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "XMLObjectBaseTestCase.h"
21 #include <xmltooling/util/TemplateEngine.h>
23 class TemplateEngineTest : public CxxTest::TestSuite {
31 void testTemplateEngine() {
32 auto_ptr<TemplateEngine> engine(new TemplateEngine());
34 TemplateEngine::TemplateParameters p;
35 p.m_map["foo1"] = "bar1";
36 p.m_map["foo3"] = "bar3";
38 string path = data_path + "template.in";
39 ifstream in(path.c_str());
42 engine->run(in,out,p);
45 path = data_path + "template.out";
46 ifstream compfile(path.c_str());
47 while (getline(compfile,path))
48 compstr += path + '\n';
50 TSM_ASSERT_EQUALS("Template output did not match.", out.str(), compstr);