<?php
declare(strict_types=1);require __DIR__.'/native.php';require $root.'/vendor/autoload.php';spl_autoload_register(static function($class)use($root){if(strpos($class,'app\\')===0){$f=$root.'/app/'.str_replace('\\','/',substr($class,4)).'.php';if(is_file($f))require $f;}},true,true);require __DIR__.'/NativePdo.php';$cases=json_decode(file_get_contents(__DIR__.'/actual-qualified-increment-plans.json'),true);$n=0;foreach($cases as $c){CoreGate::$scenario='DIRECT_SUCCESS_RETRY2';CoreGate::$ids=$c['ids'];CoreGate::$counts=[];CoreGate::$started=time();CoreGate::plan('AI',$c['queryString'],$c['bind_plan']);$n++;$keys=array_keys($c['bind_plan']);foreach([[$keys[0],0,2147001112],[$keys[0],0,'2147001111'],[$keys[0],1,PDO::PARAM_INT],[$keys[1],0,999999],[$keys[1],1,PDO::PARAM_STR]] as [$key,$index,$value]){$b=$c['bind_plan'];$b[$key][$index]=$value;try{CoreGate::plan('AI',$c['queryString'],$b);throw new LogicException('Corrupt qualified scope accepted');}catch(RuntimeException $e){$n++;}}try{CoreGate::plan('AI',str_replace('+ 0.01','+ 0.02',$c['queryString']),$c['bind_plan']);throw new LogicException('Wrong increment accepted');}catch(RuntimeException $e){$n++;}}echo json_encode(['checks'=>$n,'counterexamples'=>$n-2,'SQL'=>0,'HTTP'=>0,'original_scope_bind_type'=>2]),"\n";
