view CellTest.m @ 475:e0e81e7df671 feature/sublassable_cellarray

Add test stubs for size and length
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 02 Aug 2017 10:03:59 +0200
parents c91464ef1dd9
children 949ffe238f61
line wrap: on
line source

function tests = CellTest()
    tests = functiontests(localfunctions);
end

function testSize(testCase)
    testCase.verifyFail();
end

function testLength(testCase)
    testCase.verifyFail();
end

function testSubAssignment(testCase)
    testCase.verifyFail();
end

function testIndexreference(testCase)
    testCase.verifyFail();
end

function testConcat(testCase)
    cases = {
        {{},{}},
        {{1},{}},
        {{},{1}},
        {{1},{2}},
        {{1, 2},{3, 4}},
        {{1; 2},{3; 4}},
    };

    horzCat = {
        {},
        {1},
        {1},
        {1,2},
        {1, 2, 3, 4},
        {1, 3; 2, 4},
    };

    vertCat = {
        {},
        {1},
        {1},
        {1; 2},
        {1, 2; 3, 4},
        {1; 2; 3; 4},
    };

    for i = 1:length(cases)
        A = Cell(cases{i}{1});
        B = Cell(cases{i}{2});

        C_horz = [A, B];
        C_vert = [A; B];

        testCase.verifyEqual(C_horz.data, horzCat{i});
        testCase.verifyEqual(C_vert.data, vertCat{i});

    end
end