-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestFirstWordAttempt.m
92 lines (85 loc) · 3.91 KB
/
TestFirstWordAttempt.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Core Model, 2022
% Written by Maya Davis
% Concept by Maya Davis and Melissa A. Redford
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% METHODS TESTED
%
%
%% TESTS
function tests = TestFirstWordAttempt()
tests = functiontests(localfunctions);
end
function TestFunctionSuperSimple(testCase)
space = SimpleIdentityCVSpace();
Silhouette1 = MotorSilhouette([WeightedMotorSimplicialComplex( ...
[1 2; 4 2; 1 5; 4 5], [1 2 3; 2 3 4], [1 1]) WeightedMotorSimplicialComplex( ...
[1 2; 4 2; 1 5; 4 5], [1 2 3; 2 3 4], [1 1])]);
Silhouette2 = MotorSilhouette([WeightedMotorSimplicialComplex( ...
[1 2; 4 2; 1 5; 4 5], [1 2 3; 2 3 4], [1 1]) WeightedMotorSimplicialComplex( ...
[1 2; 4 2; 1 5; 4 5], [1 2 3; 2 3 4], [1 1])]);
Exemplar1 = PerceptualTrajectory([3 4; 20 21]);
Exemplar2 = PerceptualTrajectory([6 8; 20 25]);
SequenceVocabulary = [1 3 3 4; 1 2 3 3];
SilhouetteVocabulary = [Silhouette1 Silhouette2];
ExemplarVocabulary = [Exemplar1 Exemplar2];
GoalExemplar = PerceptualTrajectory([10 10; 12 15]);
GoalSequence = [1 2 3 4];
NumNeighbors = 2;
[actClosestSequences, actGoalSequence, actASilhouette, ...
actResultingJunctures, actDistanceVector, ...
actAverageDistance] = FirstWordAttempt(space, ...
SequenceVocabulary, SilhouetteVocabulary, ExemplarVocabulary, ...
GoalExemplar, GoalSequence, NumNeighbors);
actASilhouetteRegion1MV = actASilhouette.Regions(1).MotorVertexList;
expASilhouetteRegion1MV = [1 2; 1 5; 4 2; 4 5];
expASilhouetteRegion2MV = [];
expASilhouetteRegion1SM = [1 3 4; 2 1 4];
expASilhouetteRegion2SM = [];
expASilhouetteRegion1Weights = [2 2];
expASilhouetteRegion2Weights = [];
expResultingJuncture1 = [];
expResultingJuncture2 = [];
expDistanceVector = [];
expAverageDistance = [];
verifyEqual(testCase, actASilhouetteRegion1MV, expASilhouetteRegion1MV, "AbsTol", 0.00001);
end
function TestFunctionSimple(testCase)
space = SimpleIdentityCVSpace();
Silhouette1 = MotorSilhouette([WeightedMotorSimplicialComplex( ...
[1 2; 4 2; 1 5; 4 5], [1 2 3; 2 3 4], [1 1]) ...
WeightedMotorSimplicialComplex( ...
[20 10; 25 10; 20 12; 25 12], [1 2 3; 2 3 4], [1 1])]);
Silhouette2 = MotorSilhouette([WeightedMotorSimplicialComplex( ...
[3 3; 8 3; 3 6; 8 6], [1 2 3; 2 3 4], [1 1]) ...
WeightedMotorSimplicialComplex( ...
[21 8; 27 8; 21 12; 27 12], [1 2 3; 2 3 4], [1 1])]);
Exemplar1 = PerceptualTrajectory([3 3; 21 11]);
Exemplar2 = PerceptualTrajectory([6 4; 25 10]);
SequenceVocabulary = [1 3 3 4; 1 2 3 3];
SilhouetteVocabulary = [Silhouette1 Silhouette2];
ExemplarVocabulary = [Exemplar1 Exemplar2];
GoalExemplar = PerceptualTrajectory([10 10; 12 15]);
GoalSequence = [1 2 3 4];
NumNeighbors = 2;
[actClosestSequences, actGoalSequence, actASilhouette, ...
actResultingJunctures, actDistanceVector, ...
actAverageDistance] = FirstWordAttempt(space, ...
SequenceVocabulary, SilhouetteVocabulary, ExemplarVocabulary, ...
GoalExemplar, GoalSequence, NumNeighbors);
actASilhouetteRegion1MV = actASilhouette.Regions(1).MotorVertexList;
expASilhouetteRegion1MV = [1 2;1 3; 1 5; 3 2; 3 3; 3 5; 3 6; 4 2; ...
4 3; 4 5; 4 6; 8 3; 8 5; 8 6];
expASilhouetteRegion2MV = [];
expASilhouetteRegion1SM = [1 2 5; 1 4 5; 2 3 6; 2 5 6; 3 6 7; ...
4 5 9; 4 8 9; 5 6 10; 5 9 10; 6 7 11; 6 10 11; 8 9 12; ...
9 10 13; 9 12 13; 10 11 14; 10 13 14];
expASilhouetteRegion2SM = [];
expASilhouetteRegion1Weights = [1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1];
expASilhouetteRegion2Weights = [];
expResultingJuncture1 = [];
expResultingJuncture2 = [];
expDistanceVector = [];
expAverageDistance = [];
verifyEqual(testCase, actASilhouetteRegion1MV, expASilhouetteRegion1MV, "AbsTol", 0.00001);
end