From 6de8a6ebbf7e070d5c36b91a9cd591f129bdb897 Mon Sep 17 00:00:00 2001 From: Matthew Dawson Date: Fri, 24 Oct 2014 14:16:46 -0400 Subject: [PATCH] Start work on proper TET -> jTET converter. Put in the first step of the TET -> jTET converter (giving the table a name). Also start a test framework using the new MATLAB test framework. Currently targeting R2013a, so new parameterized tests. --- +TETTests/run.m | 9 ++++++++ +TableBlock/convert_table_to_java_table.m | 9 ++++++++ Tests/BaseConversionTest.m | 27 ++++++++++++++++++++++ Tests/ConversionTest1.m | 10 ++++++++ Tests/data/test1data.mat | Bin 0 -> 2076 bytes 5 files changed, 55 insertions(+) create mode 100644 +TETTests/run.m create mode 100644 +TableBlock/convert_table_to_java_table.m create mode 100644 Tests/BaseConversionTest.m create mode 100644 Tests/ConversionTest1.m create mode 100644 Tests/data/test1data.mat diff --git a/+TETTests/run.m b/+TETTests/run.m new file mode 100644 index 0000000..c258dd5 --- /dev/null +++ b/+TETTests/run.m @@ -0,0 +1,9 @@ +function test_results = run +%RUN Runs TET test suite +% Runs all the tests in TET, returning the result. + +path = mfilename('fullpath'); +path = [path(1:size(path, 2)-13) 'Tests']; +test_results = run(matlab.unittest.TestSuite.fromFolder(path)); +end + diff --git a/+TableBlock/convert_table_to_java_table.m b/+TableBlock/convert_table_to_java_table.m new file mode 100644 index 0000000..bae685a --- /dev/null +++ b/+TableBlock/convert_table_to_java_table.m @@ -0,0 +1,9 @@ +function outtable = convert_table_to_java_table( intable ) +%CONVERT_TABLE_TO_JAVA_TABLE Converts a given table to jTET's representation +% This function converts a table from TET's internal representation to +% jTET's representation, ready for use against any of jTET's tools. + + outtable = ca.mcscert.jtet.tabularexpression.Table(intable.function_name, []); + +end + diff --git a/Tests/BaseConversionTest.m b/Tests/BaseConversionTest.m new file mode 100644 index 0000000..46531e8 --- /dev/null +++ b/Tests/BaseConversionTest.m @@ -0,0 +1,27 @@ +classdef BaseConversionTest < matlab.unittest.TestCase + %BASECONVERSIONTEST Base test class for conversion to jTET format + % This contains all the common code for doing jTET conversion tests. + + properties (Abstract) + File + TableName + end + + properties + ConvertedTable = [] + end + + methods (TestClassSetup) + function setupOnce(testcase) + data = load(testcase.File); + testcase.ConvertedTable = TableBlock.convert_table_to_java_table(data.data); + end + end + + methods (Test) + function testTableName(testcase) + testcase.assertEqual(char(testcase.ConvertedTable.getTableName()), testcase.TableName); + end + end +end + diff --git a/Tests/ConversionTest1.m b/Tests/ConversionTest1.m new file mode 100644 index 0000000..a662fc0 --- /dev/null +++ b/Tests/ConversionTest1.m @@ -0,0 +1,10 @@ +classdef ConversionTest1 < BaseConversionTest + %CONVERSIONTEST1 Summary of this class goes here + % Detailed explanation goes here + + properties + File = 'data/test1data.mat' + TableName = 'Startup_Limiter' + end +end + diff --git a/Tests/data/test1data.mat b/Tests/data/test1data.mat new file mode 100644 index 0000000000000000000000000000000000000000..a59161d8f97bdeb2babc3e106f4593f1458b43ea GIT binary patch literal 2076 zcmV+%2;=unK~zjZLLfCRFd$7qR4ry{Y-KDUP;6mzW^ZzBIv__(PFO)UG%O%Pa%Ew3 zWn>_4ZaN@MZ*Cw@V{{-fGaxZCIyEyoGC3eJFflYBARr(hARr(hARr(hARr(hARr(h zARr(hARr(hARr(hARr(hARr*l00000000000ZB~{0000+0001Zoa19)V5k6MHX!Bz zVnGH7U}RunNJ%V71kt|E{=p#H1<2M}c-w@wfqoGu zq2jV~?6tkZUa#!68ZIaYkb3Ef0}_|=S5S#lPMkS%fg4gUZ4g|LIKa&8oA`O`q#?U4 zR#$pE@4cPhypMS^v%7Hsu+sqjtPL}YfP3vhIlxFuyDh(hC_`ZWCYR%kzDu?6!7g}7 zu0AB51+dS}+1pt;&RsIjUhE&(Y(t_imt%~snib=ddd{|ux~?OBgy38DT=`SQ58nTN zceMUeSw{T!{@>snx}>reoGD zF}Cg^6eSLzXjfIm=c=MsEH(^jxY;P<=vK3;yUvOyZX|UcHY|uczoo@}3M}KE=*&GY z7!|`YHbv1FGmsZy+ZEH{Pk0ihpl&pp6$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