Datasets:
Download code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/media-sync.test.ts from VEHwang/cocogni4d: direct link, hf CLI and curl.
- Browser
- Download file 966 Bytes
-
https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/media-sync.test.ts
- Command line
-
hf download hf://datasets/VEHwang/cocogni4d/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/media-sync.test.ts
-
curl -L -o media-sync.test.ts https://huggingface.co/datasets/VEHwang/cocogni4d/resolve/main/code/evaluation-code/v0.2-0c2690ae/apps/console/web/tests/media-sync.test.ts
966 Bytes
| import test from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import {SEEK_DRIFT_S,nudgedRate,syncStep,mustWait} from '../src/media-sync.ts'; | |
| test('small drift is chased by rate, large drift seeks', () => { | |
| assert.deepEqual(syncStep(.005,1),{seek:false,rate:1}); | |
| const behind=syncStep(.03,1);assert.equal(behind.seek,false);assert.ok(behind.rate>1&&behind.rate<=1.04); | |
| const ahead=syncStep(-.03,2);assert.equal(ahead.seek,false);assert.ok(ahead.rate<2&&ahead.rate>=2*.96); | |
| assert.equal(syncStep(SEEK_DRIFT_S+.001,1).seek,true); | |
| assert.equal(syncStep(-.5,1).seek,true); | |
| }); | |
| test('rate nudge is capped at 4 %', () => { | |
| assert.equal(nudgedRate(10,1),1.04); | |
| assert.equal(nudgedRate(-10,1),.96); | |
| }); | |
| test('a seeking or under-buffered route holds every route', () => { | |
| assert.equal(mustWait({seeking:false,readyState:4}),false); | |
| assert.equal(mustWait({seeking:true,readyState:4}),true); | |
| assert.equal(mustWait({seeking:false,readyState:2}),true); | |
| }); | |