classdef ConversionTest1 < BaseConversionTest
    %CONVERSIONTEST1 Summary of this class goes here
    %   Detailed explanation goes here

    properties
        File = 'data/test1data.mat'
        TableName = 'Startup_Limiter'
    end

    methods (Test)
        function testVariableParsing(testcase)
            vc = testcase.ConvertedTable.getVariables();

            inVar = vc.getInputVariables();
            testcase.assertEqual(inVar.size(), 2);
            testcase.assertEqual(char(inVar.get('Start').name()), 'Start');
            testcase.assertEqual(char(inVar.get('Input').name()), 'Input');

            outVar = vc.getOutputVariables();
            testcase.assertEqual(outVar.size(), 1);
            testcase.assertEqual(char(outVar.get('output').name()), 'output');
        end

        function testLeftGridConversion(testcase)
            grid = testcase.ConvertedTable.getLeftGrid().getSubHierarchy();
            testcase.assertEqual(grid.size(), 2)
            testcase.assertEqual(char(grid.get(0).contents()), 'Start')
            testcase.assertEqual(grid.get(0).getSubHierarchy().size(), 0)
            testcase.assertEqual(char(grid.get(1).contents()), '~Start')

            grid = grid.get(1).getSubHierarchy();
            testcase.assertEqual(grid.size(), 2)
            testcase.assertEqual(char(grid.get(0).contents()), 'Input < 1000')
            testcase.assertEqual(grid.get(0).getSubHierarchy().size(), 0)
            testcase.assertEqual(char(grid.get(1).contents()), 'Input >= 1000')
            testcase.assertEqual(grid.get(1).getSubHierarchy().size(), 0)
        end

        function testTopGridConversion(testcase)
            testcase.assertEqual(testcase.ConvertedTable.getTopGrid().getSubHierarchy().size(), 0)
        end

        function testOutptGridConversion(testcase)
            grid = testcase.ConvertedTable.getVariableOutputs().get(testcase.ConvertedTable.getVariables().getOutputVariables().get('output'));
            testcase.assertEqual(grid.sizeX(), 1)
            testcase.assertEqual(grid.sizeY(), 3)

            testcase.assertEqual(char(grid.get(0, 0).contents()), '0')
            testcase.assertEqual(char(grid.get(0, 1).contents()), 'Input')
            testcase.assertEqual(char(grid.get(0, 2).contents()), '1000')
        end
    end
end

