Skip to content

Commit

Permalink
tests: add test cases for DF and NDF variants of 29.97 and 59.94
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Mar 18, 2024
1 parent cbb9cee commit ba99930
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 19,691,433 deletions.
25 changes: 16 additions & 9 deletions src/timecodes-all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Timecode } from './timecode';

async function runTimecodesTest(
rate: Rate,
dropFrame: boolean,
filename: string,
maxFrames?: number
) {
Expand All @@ -34,7 +35,7 @@ async function runTimecodesTest(
if (line.trim() === '') continue;

// Frame index -> timecode string
const tcFromIndex = new Timecode(frameIndex, rate, rate.drop > 0);
const tcFromIndex = new Timecode(frameIndex, rate, dropFrame);
expect(tcFromIndex.toString()).toBe(line);

// Timecode string -> frameIndex
Expand All @@ -54,21 +55,27 @@ async function runTimecodesTest(

describe('test all timecodes exhaustively', () => {
test('all timecodes - 23.976', async () => {
await runTimecodesTest(Rate_23_976, 'tc-all-23_976.txt', 10000);
await runTimecodesTest(Rate_23_976, false, 'tc-all-23_976.txt', 10000);
});
test('all timecodes - 24', async () => {
await runTimecodesTest(Rate_24, 'tc-all-24.txt', 10000);
await runTimecodesTest(Rate_24, false, 'tc-all-24.txt', 10000);
});
test('all timecodes - 29.97', async () => {
await runTimecodesTest(Rate_29_97, 'tc-all-29_97.txt', 10000);
test('all timecodes - 29.97 NDF', async () => {
await runTimecodesTest(Rate_29_97, false, 'tc-all-30.txt', 10000);
});
test('all timecodes - 29.97 DF', async () => {
await runTimecodesTest(Rate_29_97, true, 'tc-all-29_97.txt', 10000);
});
test('all timecodes - 30', async () => {
await runTimecodesTest(Rate_30, 'tc-all-30.txt', 10000);
await runTimecodesTest(Rate_30, false, 'tc-all-30.txt', 10000);
});
test('all timecodes - 59.94 NDF', async () => {
await runTimecodesTest(Rate_59_94, false, 'tc-all-60.txt', 10000);
});
test('all timecodes - 59.94', async () => {
await runTimecodesTest(Rate_59_94, 'tc-all-59_94.txt', 10000);
test('all timecodes - 59.94 DF', async () => {
await runTimecodesTest(Rate_59_94, true, 'tc-all-59_94.txt', 10000);
});
test('all timecodes - 60', async () => {
await runTimecodesTest(Rate_60, 'tc-all-60.txt', 10000);
await runTimecodesTest(Rate_60, false, 'tc-all-60.txt', 10000);
});
});
Loading

0 comments on commit ba99930

Please sign in to comment.