classdef DataTest < matlab.unittest.TestCase

    methods (Test)
        function testInit(testcase)
            d = Data;
            d.init;
            testcase.assertEqual(size(d.Grid2.cells,2),1);
            testcase.assertEqual(size(d.Grid1.cells,2),1);
            testcase.assertEqual(size(d.Grid0.Cells,2),1);
        end

        function testClone(testcase)
            d = Data;
            d.init;
            d.function_name = 'test_name';
            d.function_inputs = 'input_test';
            d.checked = 1;
            d.Grid1.cells(1).cond_text = 'test_cond';
            d2 = d.clone([]);
            testcase.assertEqual(d2.function_name,'');
            testcase.assertEqual(d2.function_inputs,d.function_inputs);
            testcase.assertEqual(d2.Grid1.cells(1).cond_text,'test_cond');
        end

        function testClone2(testcase)
            d = Data;
            d2 = d.clone;
            testcase.assertEqual(d2,[]);
        end

        function testSave(testcase)
            d = Data;
            d.init;
            d.function_name = 'test_file';
            d.save;
            testcase.assertEqual(exist('test_file.table'),2);
            delete('test_file.table');
        end
    end
end
