[opengtl-commits] [605] add a test for the Source class |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 605
Author: cyrille
Date: 2009-03-13 17:48:42 +0100 (Fri, 13 Mar 2009)
Log Message:
-----------
add a test for the Source class
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/tests/library/TestOpenShiva.cpp
Added Paths:
-----------
trunk/OpenGTL/OpenShiva/tests/library/TestSource.h
Modified: trunk/OpenGTL/OpenShiva/tests/library/TestOpenShiva.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/library/TestOpenShiva.cpp 2009-03-13 16:38:43 UTC (rev 604)
+++ trunk/OpenGTL/OpenShiva/tests/library/TestOpenShiva.cpp 2009-03-13 16:48:42 UTC (rev 605)
@@ -26,9 +26,11 @@
#include "TestLexer.h"
#include "TestMetadataLexer.h"
#include "TestMetadataParser.h"
+#include "TestSource.h"
GTLTEST_MAIN_BEGIN(TestOpenShiva)
GTLTEST_MAIN_ADD_CASE(TestLexer)
GTLTEST_MAIN_ADD_CASE(TestMetadataLexer )
GTLTEST_MAIN_ADD_CASE(TestMetadataParser)
+GTLTEST_MAIN_ADD_CASE(TestSource)
GTLTEST_MAIN_END()
Added: trunk/OpenGTL/OpenShiva/tests/library/TestSource.h
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/library/TestSource.h (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/library/TestSource.h 2009-03-13 16:48:42 UTC (rev 605)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2009 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * either version 2, or (at your option) any later version of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "OpenShiva/Source.h"
+
+class TestSource : public GTLTest::Case {
+ public:
+ TestSource() : GTLTest::Case("Source") {}
+ virtual void runTest()
+ {
+ GTLCore::String sourceCodeGenerator = "\
+kernel myGenerator { \
+ void evaluatePixel(out pixel result) \
+ { } \
+}";
+ OpenShiva::Source sourceGenerator;
+ sourceGenerator.setSource(sourceCodeGenerator);
+ GTLTEST_CHECK_EQUAL( sourceGenerator.source(), sourceCodeGenerator );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.name(), "myGenerator" );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.metadataCompilationErrors().size(), 0 );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.sourceType(), OpenShiva::Source::GeneratorKernel );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.outputImageType(), OpenShiva::Source::Image );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.countInputImages(), 0 );
+ GTLTEST_CHECK_EQUAL( sourceGenerator.inputImageType(0), OpenShiva::Source::InvalidImage );
+ }
+};
+
Property changes on: trunk/OpenGTL/OpenShiva/tests/library/TestSource.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native