Skip to content

Commit 7f2e72f

Browse files
committed
add tests for MST
1 parent 95c46f9 commit 7f2e72f

File tree

7 files changed

+108
-17
lines changed

7 files changed

+108
-17
lines changed

tests/test_expDesign.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
initTestSuite;
77
end
88

9-
function test_expDesignBasic()
9+
function test_expDesign_MT()
1010

1111
isMT = true;
1212

@@ -15,3 +15,13 @@ function test_expDesignBasic()
1515
[cfg] = expDesign(cfg);
1616

1717
end
18+
19+
function test_expDesign_MST()
20+
21+
isMT = false;
22+
23+
cfg = getMockConfig(isMT);
24+
25+
[cfg] = expDesign(cfg);
26+
27+
end

tests/test_getDesignInput.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,30 @@
66
initTestSuite;
77
end
88

9-
function test_setSpeedTargetsBasic()
9+
function test_setSpeedTargets_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
1313

1414
[nbRepetitions, nbEventsPerBlock, maxNbPerBlock, nbBlocks] = getDesignInput(cfg);
1515

1616
assertEqual(nbRepetitions, 12);
17-
assertEqual(nbEventsPerBlock, 12);
17+
assertEqual(nbEventsPerBlock, cfg.design.nbEventsPerBlock);
1818
assertEqual(maxNbPerBlock, 2);
1919
assertEqual(nbBlocks, 24);
2020

2121
end
22+
23+
function test_setSpeedTargets_MST()
24+
25+
isMT = false;
26+
cfg = getMockConfig(isMT);
27+
28+
[nbRepetitions, nbEventsPerBlock, maxNbPerBlock, nbBlocks] = getDesignInput(cfg);
29+
30+
assertEqual(nbRepetitions, 24);
31+
assertEqual(nbEventsPerBlock, cfg.design.nbEventsPerBlock);
32+
assertEqual(maxNbPerBlock, 2);
33+
assertEqual(nbBlocks, 48);
34+
35+
end

tests/test_getDirectionBaseVectors.m

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
initTestSuite;
77
end
88

9-
function test_getDirectionBaseVectorsBasic()
9+
function test_getDirectionBaseVectors_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
@@ -17,3 +17,15 @@ function test_getDirectionBaseVectorsBasic()
1717
assertEqual(directionsCondition2, [0 180]);
1818

1919
end
20+
21+
function test_getDirectionBaseVectors_MST()
22+
23+
isMT = false;
24+
cfg = getMockConfig(isMT);
25+
26+
[directionsCondition1, directionsCondition2] = getDirectionBaseVectors(cfg);
27+
28+
assertEqual(directionsCondition1, [-1 -1]);
29+
assertEqual(directionsCondition2, [666 -666]);
30+
31+
end

tests/test_setBlocksConditions.m

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
initTestSuite;
77
end
88

9-
function test_getDirectionBaseVectorsBasic()
9+
function test_getDirectionBaseVectors_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
@@ -18,3 +18,16 @@ function test_getDirectionBaseVectorsBasic()
1818
assertEqual(idxCondition2, [2:2:24]');
1919

2020
end
21+
22+
function test_getDirectionBaseVectors_MST()
23+
24+
isMT = false;
25+
cfg = getMockConfig(isMT);
26+
27+
[conditionNamesVector, idxCondition1, idxCondition2] = setBlocksConditions(cfg);
28+
29+
assertEqual(conditionNamesVector, repmat({'static'; 'motion'}, 24, 1));
30+
assertEqual(idxCondition1, [1:2:47]');
31+
assertEqual(idxCondition2, [2:2:48]');
32+
33+
end

tests/test_setDirections.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
initTestSuite;
77
end
88

9-
function test_setDirectionsMT()
9+
function test_setDirections_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
1313

1414
directions = setDirections(cfg);
1515

16-
assertEqual(size(directions), [24, 12]);
16+
assertEqual(size(directions), [24, cfg.design.nbEventsPerBlock]);
1717

1818
% only left right and static
1919
assertEqual(unique(directions), [-1; 0; 180]);
2020

2121
% static every second block
22-
assertEqual(directions(1:2:end, :), ones(12, 12) * -1);
22+
assertEqual(directions(1:2:end, :), ones(12, cfg.design.nbEventsPerBlock) * -1);
2323

2424
end
2525

26-
function test_setDirectionsMST()
26+
function test_setDirections_MST()
2727

2828
isMT = false;
2929
cfg = getMockConfig(isMT);
3030

3131
directions = setDirections(cfg);
3232

33-
assertEqual(size(directions), [48, 24]);
33+
assertEqual(size(directions), [48, cfg.design.nbEventsPerBlock]);
3434

3535
% only left right and static
3636
assertEqual(unique(directions), [-666; -1; 666]);

tests/test_setFixationTargets.m

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
initTestSuite;
77
end
88

9-
function test_setFixationTargetsBasic()
9+
function test_setFixationTargets_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
@@ -17,8 +17,7 @@ function test_setFixationTargetsBasic()
1717
assertTrue(~any(fixationTargets(:, 1)));
1818
assertTrue(~any(fixationTargets(:, end)));
1919

20-
% no target one after the other
21-
% TODO
20+
% TODO no target one after the other
2221

2322
% at least one target for each allowed position
2423
assertTrue(all(sum(fixationTargets(:, 2:end - 1))) > 0);
@@ -28,6 +27,31 @@ function test_setFixationTargetsBasic()
2827

2928
fixationTargets = setFixationTargets(cfg);
3029

31-
assertEqual(fixationTargets, zeros(24, 12));
30+
assertEqual(fixationTargets, zeros(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock));
31+
32+
end
33+
34+
function test_setFixationTargets_MST()
35+
36+
isMT = false;
37+
cfg = getMockConfig(isMT);
38+
39+
fixationTargets = setFixationTargets(cfg);
40+
41+
% no target on first and last event of a block
42+
assertTrue(~any(fixationTargets(:, 1)));
43+
assertTrue(~any(fixationTargets(:, end)));
44+
45+
% TODO no target one after the other
46+
47+
% TODO at least one target for each allowed position
48+
% assertTrue(all(sum(fixationTargets(:, 2:end - 1))) > 0);
49+
50+
% try when the target are just for the fixation cross
51+
cfg.target.type = {'speed'};
52+
53+
fixationTargets = setFixationTargets(cfg);
54+
55+
assertEqual(fixationTargets, zeros(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock));
3256

3357
end

tests/test_setSpeedTargets.m

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,38 @@
66
initTestSuite;
77
end
88

9-
function test_setSpeedTargetsBasic()
9+
function test_setSpeedTargets_MT()
1010

1111
isMT = true;
1212
cfg = getMockConfig(isMT);
1313

1414
speeds = setSpeedTargets(cfg);
1515

16-
assertEqual(speeds, ones(24, 12) * 28);
16+
assertEqual(speeds, ones(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock) * 28);
1717

1818
% try when the target are just for the fixation cross
1919
cfg.target.type = {'fixation_cross'};
2020

2121
speeds = setSpeedTargets(cfg);
2222

23-
assertEqual(speeds, ones(24, 12) * 28);
23+
assertEqual(speeds, ones(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock) * 28);
24+
25+
end
26+
27+
function test_setSpeedTargets_MST()
28+
29+
isMT = false;
30+
cfg = getMockConfig(isMT);
31+
32+
speeds = setSpeedTargets(cfg);
33+
34+
assertEqual(speeds, ones(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock) * 28);
35+
36+
% try when the target are just for the fixation cross
37+
cfg.target.type = {'fixation_cross'};
38+
39+
speeds = setSpeedTargets(cfg);
40+
41+
assertEqual(speeds, ones(cfg.design.nbRepetitions * 2, cfg.design.nbEventsPerBlock) * 28);
2442

2543
end

0 commit comments

Comments
 (0)