Skip to content

Commit 504fd0e

Browse files
committed
KeyFrame_Tests.cpp: Correct usage for CHECK_EQUAL
It's CHECK_EQUAL(expected, actual), not the other way around!
1 parent 86c1df2 commit 504fd0e

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

tests/KeyFrame_Tests.cpp

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ TEST(Keyframe_GetValue_For_Bezier_Curve_2_Points)
9898
CHECK_CLOSE(3.79733f, kf.GetValue(40), 0.0001);
9999
CHECK_CLOSE(4.0f, kf.GetValue(50), 0.0001);
100100
// Check the expected number of values
101-
CHECK_EQUAL(kf.GetLength(), 51);
101+
CHECK_EQUAL(51, kf.GetLength());
102102
}
103103

104104
TEST(Keyframe_GetValue_For_Bezier_Curve_5_Points_40_Percent_Handle)
@@ -121,7 +121,7 @@ TEST(Keyframe_GetValue_For_Bezier_Curve_5_Points_40_Percent_Handle)
121121
CHECK_CLOSE(1.73860f, kf.GetValue(177), 0.0001);
122122
CHECK_CLOSE(3.0f, kf.GetValue(200), 0.0001);
123123
// Check the expected number of values
124-
CHECK_EQUAL(kf.GetLength(), 201);
124+
CHECK_EQUAL(201, kf.GetLength());
125125
}
126126

127127
TEST(Keyframe_GetValue_For_Bezier_Curve_5_Points_25_Percent_Handle)
@@ -144,7 +144,7 @@ TEST(Keyframe_GetValue_For_Bezier_Curve_5_Points_25_Percent_Handle)
144144
CHECK_CLOSE(1.73860f, kf.GetValue(177), 0.0001);
145145
CHECK_CLOSE(3.0f, kf.GetValue(200), 0.0001);
146146
// Check the expected number of values
147-
CHECK_EQUAL(kf.GetLength(), 201);
147+
CHECK_EQUAL(201, kf.GetLength());
148148
}
149149

150150
TEST(Keyframe_GetValue_For_Linear_Curve_3_Points)
@@ -164,7 +164,7 @@ TEST(Keyframe_GetValue_For_Linear_Curve_3_Points)
164164
CHECK_CLOSE(4.4f, kf.GetValue(40), 0.0001);
165165
CHECK_CLOSE(2.0f, kf.GetValue(50), 0.0001);
166166
// Check the expected number of values
167-
CHECK_EQUAL(kf.GetLength(), 51);
167+
CHECK_EQUAL(51, kf.GetLength());
168168
}
169169

170170
TEST(Keyframe_GetValue_For_Constant_Curve_3_Points)
@@ -185,7 +185,7 @@ TEST(Keyframe_GetValue_For_Constant_Curve_3_Points)
185185
CHECK_CLOSE(8.0f, kf.GetValue(49), 0.0001);
186186
CHECK_CLOSE(2.0f, kf.GetValue(50), 0.0001);
187187
// Check the expected number of values
188-
CHECK_EQUAL(kf.GetLength(), 51);
188+
CHECK_EQUAL(51, kf.GetLength());
189189
}
190190

191191
TEST(Keyframe_Check_Direction_and_Repeat_Fractions)
@@ -197,29 +197,29 @@ TEST(Keyframe_Check_Direction_and_Repeat_Fractions)
197197
kf.AddPoint(500, 500);
198198

199199
// Spot check values from the curve
200-
CHECK_EQUAL(kf.GetInt(1), 500);
201-
CHECK_EQUAL(kf.IsIncreasing(1), false);
202-
CHECK_EQUAL(kf.GetRepeatFraction(1).num, 1);
203-
CHECK_EQUAL(kf.GetRepeatFraction(1).den, 13);
204-
CHECK_EQUAL(kf.GetDelta(1), 500);
205-
206-
CHECK_EQUAL(kf.GetInt(24), 498);
207-
CHECK_EQUAL(kf.IsIncreasing(24), false);
208-
CHECK_EQUAL(kf.GetRepeatFraction(24).num, 3);
209-
CHECK_EQUAL(kf.GetRepeatFraction(24).den, 6);
210-
CHECK_EQUAL(kf.GetDelta(24), 0);
211-
212-
CHECK_EQUAL(kf.GetLong(390), 100);
213-
CHECK_EQUAL(kf.IsIncreasing(390), true);
214-
CHECK_EQUAL(kf.GetRepeatFraction(390).num, 3);
215-
CHECK_EQUAL(kf.GetRepeatFraction(390).den, 16);
216-
CHECK_EQUAL(kf.GetDelta(390), 0);
217-
218-
CHECK_EQUAL(kf.GetLong(391), 100);
219-
CHECK_EQUAL(kf.IsIncreasing(391), true);
220-
CHECK_EQUAL(kf.GetRepeatFraction(391).num, 4);
221-
CHECK_EQUAL(kf.GetRepeatFraction(391).den, 16);
222-
CHECK_EQUAL(kf.GetDelta(388), -1);
200+
CHECK_EQUAL(500, kf.GetInt(1));
201+
CHECK_EQUAL(false, kf.IsIncreasing(1));
202+
CHECK_EQUAL(1, kf.GetRepeatFraction(1).num);
203+
CHECK_EQUAL(13, kf.GetRepeatFraction(1).den);
204+
CHECK_EQUAL(500, kf.GetDelta(1));
205+
206+
CHECK_EQUAL(498, kf.GetInt(24));
207+
CHECK_EQUAL(false, kf.IsIncreasing(24));
208+
CHECK_EQUAL(3, kf.GetRepeatFraction(24).num);
209+
CHECK_EQUAL(6, kf.GetRepeatFraction(24).den);
210+
CHECK_EQUAL(0, kf.GetDelta(24));
211+
212+
CHECK_EQUAL(100, kf.GetLong(390));
213+
CHECK_EQUAL(true, kf.IsIncreasing(390));
214+
CHECK_EQUAL(3, kf.GetRepeatFraction(390).num);
215+
CHECK_EQUAL(16, kf.GetRepeatFraction(390).den);
216+
CHECK_EQUAL(0, kf.GetDelta(390));
217+
218+
CHECK_EQUAL(100, kf.GetLong(391));
219+
CHECK_EQUAL(true, kf.IsIncreasing(391));
220+
CHECK_EQUAL(4, kf.GetRepeatFraction(391).num);
221+
CHECK_EQUAL(16, kf.GetRepeatFraction(391).den);
222+
CHECK_EQUAL(-1, kf.GetDelta(388));
223223
}
224224

225225

@@ -232,22 +232,22 @@ TEST(Keyframe_Get_Closest_Point)
232232
kf.AddPoint(2500, 0.0);
233233

234234
// Spot check values from the curve (to the right)
235-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(900, 900)).co.X, 1000);
236-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1, 1)).co.X, 1);
237-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(5, 5)).co.X, 1000);
238-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1000, 1000)).co.X, 1000);
239-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1001, 1001)).co.X, 2500);
240-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(2500, 2500)).co.X, 2500);
241-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(3000, 3000)).co.X, 2500);
235+
CHECK_EQUAL(1000, kf.GetClosestPoint(openshot::Point(900, 900)).co.X);
236+
CHECK_EQUAL(1, kf.GetClosestPoint(openshot::Point(1, 1)).co.X);
237+
CHECK_EQUAL(1000, kf.GetClosestPoint(openshot::Point(5, 5)).co.X);
238+
CHECK_EQUAL(1000, kf.GetClosestPoint(openshot::Point(1000, 1000)).co.X);
239+
CHECK_EQUAL(2500, kf.GetClosestPoint(openshot::Point(1001, 1001)).co.X);
240+
CHECK_EQUAL(2500, kf.GetClosestPoint(openshot::Point(2500, 2500)).co.X);
241+
CHECK_EQUAL(2500, kf.GetClosestPoint(openshot::Point(3000, 3000)).co.X);
242242

243243
// Spot check values from the curve (to the left)
244-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(900, 900), true).co.X, 1);
245-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1, 1), true).co.X, 1);
246-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(5, 5), true).co.X, 1);
247-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1000, 1000), true).co.X, 1);
248-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(1001, 1001), true).co.X, 1000);
249-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(2500, 2500), true).co.X, 1000);
250-
CHECK_EQUAL(kf.GetClosestPoint(openshot::Point(3000, 3000), true).co.X, 2500);
244+
CHECK_EQUAL(1, kf.GetClosestPoint(openshot::Point(900, 900), true).co.X);
245+
CHECK_EQUAL(1, kf.GetClosestPoint(openshot::Point(1, 1), true).co.X);
246+
CHECK_EQUAL(1, kf.GetClosestPoint(openshot::Point(5, 5), true).co.X);
247+
CHECK_EQUAL(1, kf.GetClosestPoint(openshot::Point(1000, 1000), true).co.X);
248+
CHECK_EQUAL(1000, kf.GetClosestPoint(openshot::Point(1001, 1001), true).co.X);
249+
CHECK_EQUAL(1000, kf.GetClosestPoint(openshot::Point(2500, 2500), true).co.X);
250+
CHECK_EQUAL(2500, kf.GetClosestPoint(openshot::Point(3000, 3000), true).co.X);
251251
}
252252

253253

@@ -260,13 +260,13 @@ TEST(Keyframe_Get_Previous_Point)
260260
kf.AddPoint(2500, 0.0);
261261

262262
// Spot check values from the curve
263-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(900, 900))).co.X, 1);
264-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1, 1))).co.X, 1);
265-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(5, 5))).co.X, 1);
266-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1000, 1000))).co.X, 1);
267-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1001, 1001))).co.X, 1000);
268-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(2500, 2500))).co.X, 1000);
269-
CHECK_EQUAL(kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(3000, 3000))).co.X, 1000);
263+
CHECK_EQUAL(1, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(900, 900))).co.X);
264+
CHECK_EQUAL(1, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1, 1))).co.X);
265+
CHECK_EQUAL(1, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(5, 5))).co.X);
266+
CHECK_EQUAL(1, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1000, 1000))).co.X);
267+
CHECK_EQUAL(1000, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(1001, 1001))).co.X);
268+
CHECK_EQUAL(1000, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(2500, 2500))).co.X);
269+
CHECK_EQUAL(1000, kf.GetPreviousPoint(kf.GetClosestPoint(openshot::Point(3000, 3000))).co.X);
270270

271271
}
272272

@@ -277,22 +277,22 @@ TEST(Keyframe_Get_Max_Point)
277277
kf.AddPoint(1, 1.0);
278278

279279
// Spot check values from the curve
280-
CHECK_EQUAL(kf.GetMaxPoint().co.Y, 1.0);
280+
CHECK_EQUAL(1.0, kf.GetMaxPoint().co.Y);
281281

282282
kf.AddPoint(2, 0.0);
283283

284284
// Spot check values from the curve
285-
CHECK_EQUAL(kf.GetMaxPoint().co.Y, 1.0);
285+
CHECK_EQUAL(1.0, kf.GetMaxPoint().co.Y);
286286

287287
kf.AddPoint(3, 2.0);
288288

289289
// Spot check values from the curve
290-
CHECK_EQUAL(kf.GetMaxPoint().co.Y, 2.0);
290+
CHECK_EQUAL(2.0, kf.GetMaxPoint().co.Y);
291291

292292
kf.AddPoint(4, 1.0);
293293

294294
// Spot check values from the curve
295-
CHECK_EQUAL(kf.GetMaxPoint().co.Y, 2.0);
295+
CHECK_EQUAL(2.0, kf.GetMaxPoint().co.Y);
296296
}
297297

298298
TEST(Keyframe_Scale_Keyframe)
@@ -380,24 +380,24 @@ TEST(Keyframe_Remove_Duplicate_Point)
380380
kf.AddPoint(1, 2.0);
381381

382382
// Spot check values from the curve
383-
CHECK_EQUAL(kf.GetLength(), 1);
384-
CHECK_CLOSE(kf.GetPoint(0).co.Y, 2.0, 0.01);
383+
CHECK_EQUAL(1, kf.GetLength());
384+
CHECK_CLOSE(2.0, kf.GetPoint(0).co.Y, 0.01);
385385
}
386386

387387
TEST(Keyframe_Large_Number_Values)
388388
{
389389
// Large value
390-
int64_t large_value = 30 * 60 * 90;
390+
int64_t const large_value = 30 * 60 * 90;
391391

392392
// Create a keyframe curve with 2 points
393393
Keyframe kf;
394394
kf.AddPoint(1, 1.0);
395395
kf.AddPoint(large_value, 100.0); // 90 minutes long
396396

397397
// Spot check values from the curve
398-
CHECK_EQUAL(kf.GetLength(), large_value + 1);
399-
CHECK_CLOSE(kf.GetPoint(0).co.Y, 1.0, 0.01);
400-
CHECK_CLOSE(kf.GetPoint(1).co.Y, 100.0, 0.01);
398+
CHECK_EQUAL(large_value + 1, kf.GetLength());
399+
CHECK_CLOSE(1.0, kf.GetPoint(0).co.Y, 0.01);
400+
CHECK_CLOSE(100.0, kf.GetPoint(1).co.Y, 0.01);
401401
}
402402

403403
TEST(Keyframe_Remove_Point)

0 commit comments

Comments
 (0)