$sha, 'markdown_sha256' => str_repeat('b', 64), 'truncated' => false, 'gaps' => [], 'segments' => [ ['start_seconds'=>0,'end_seconds'=>30,'transcript_ref'=>'t1','visual_ref'=>'v1'], ['start_seconds'=>30,'end_seconds'=>60,'transcript_ref'=>'t2','visual_ref'=>'v2'], ], ]; $cases = [ [$valid, true], [array_replace($valid, ['truncated'=>true]), false], [array_replace($valid, ['gaps'=>[[30,31]]]), false], [array_replace($valid, ['video_sha256'=>str_repeat('c',64)]), false], [array_replace($valid, ['segments'=>[['start_seconds'=>1,'end_seconds'=>60,'transcript_ref'=>'t','visual_ref'=>'v']]]), false], [array_replace($valid, ['segments'=>[['start_seconds'=>0,'end_seconds'=>59,'transcript_ref'=>'t','visual_ref'=>'v']]]), false], [array_replace($valid, ['segments'=>[['start_seconds'=>0,'end_seconds'=>30,'transcript_ref'=>'t','visual_ref'=>'v'],['start_seconds'=>31,'end_seconds'=>60,'transcript_ref'=>'t','visual_ref'=>'v']]]), false], [array_replace($valid, ['segments'=>[['start_seconds'=>0,'end_seconds'=>60,'transcript_ref'=>'','visual_ref'=>'v']]]), false], ]; foreach ($cases as $index => [$coverage, $expected]) { if (VideoCoverageValidator::valid($coverage, 60, $sha) !== $expected) { throw new RuntimeException("Coverage case {$index} failed"); } } echo 'PASS ' . count($cases) . " video coverage cases\n";