File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ public class Session : MonoBehaviour
158
158
public Trial PrevTrial { get { return GetPrevTrial ( ) ; } }
159
159
160
160
/// <summary>
161
- /// Get the last trial in the last block of the session.
161
+ /// Get the first trial in the first block of the session.
162
162
/// </summary>
163
163
public Trial FirstTrial { get { return GetFirstTrial ( ) ; } }
164
164
@@ -648,7 +648,7 @@ Trial GetLastTrial()
648
648
Block lastBlock ;
649
649
try
650
650
{
651
- lastBlock = blocks [ 0 ] ;
651
+ lastBlock = blocks [ blocks . Count - 1 ] ;
652
652
}
653
653
catch ( ArgumentOutOfRangeException )
654
654
{
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ public void SwapTrials()
133
133
[ Test ]
134
134
public void InvalidTrialAccess ( )
135
135
{
136
- Block block = session . CreateBlock ( ) ;
136
+ session . CreateBlock ( ) ;
137
137
138
138
Assert . Throws < NoSuchTrialException > (
139
139
delegate { Trial t = session . FirstTrial ; }
@@ -158,6 +158,19 @@ public void InvalidBlockAccess()
158
158
delegate { Trial t = session . LastTrial ; }
159
159
) ;
160
160
}
161
+
162
+ [ Test ]
163
+ public void FirstLast ( )
164
+ {
165
+ Block block1 = session . CreateBlock ( 10 ) ;
166
+ Block block2 = session . CreateBlock ( 10 ) ;
167
+
168
+ Assert . AreEqual ( block1 . trials [ 0 ] , session . FirstTrial ) ;
169
+ Assert . AreEqual ( block2 . trials [ 9 ] , session . LastTrial ) ;
170
+
171
+ // reset blocks
172
+ session . blocks = new List < Block > ( ) ;
173
+ }
161
174
162
175
}
163
176
You can’t perform that action at this time.
0 commit comments