fix(accounting): stabilize numeric mapping identity across property storage
This commit is contained in:
@@ -53,4 +53,14 @@ $c['sources'][0]['factorToW']=2.;check(take($c,$m,$n)['mappingId']!==$a,'factor
|
||||
[$c,$m,$n]=fixture();$calls=[];
|
||||
fails(function()use($c,$m,$n,&$calls){B::aufnehmen($c,function($id)use($m,&$calls){$calls[$id]=($calls[$id]??0)+1;$v=$m[$id];if($calls[$id]>1)$v['value']++;return $v;},$n);},'same-second concurrent value change rejected');
|
||||
$source=file_get_contents(__DIR__.'/../../libs/NetzfahrplanV4Bilanzierung.php');check(!preg_match('/\b(?:SetValue|IPS_RequestAction|RequestAction|curl_exec|IPS_SetProperty|AC_SetLoggingStatus)\s*\(/',$source),'adapter has no runtime or external write calls');
|
||||
[$c,$m,$n]=fixture();$integer=$c;$integer['splitToleranceW']=100;
|
||||
check(B::konfigurieren($c)===B::konfigurieren($integer),'integer and float tolerance normalize identically');
|
||||
check(take($c,$m,$n)['mappingId']===take($integer,$m,$n)['mappingId'],'equal tolerance gives identical mapping hash');
|
||||
$roundtrip=json_decode(json_encode($c,JSON_THROW_ON_ERROR),true,64,JSON_THROW_ON_ERROR);
|
||||
check(take($roundtrip,$m,$n)['mappingId']===take($c,$m,$n)['mappingId'],'plain JSON property roundtrip preserves mapping');
|
||||
$normalized=B::konfigurieren($c);check(B::konfigurieren($normalized)===$normalized,'normalization remains idempotent');
|
||||
check(is_int($integer['splitToleranceW']) && is_float($c['splitToleranceW']),'input configurations are not mutated');
|
||||
$changed=$c;$changed['splitToleranceW']=101;
|
||||
check(take($changed,$m,$n)['mappingId']!==take($c,$m,$n)['mappingId'],'real tolerance change still changes identity');
|
||||
foreach([true,'100'] as $invalid){$bad=$c;$bad['splitToleranceW']=$invalid;fails(fn()=>B::konfigurieren($bad),'non-numeric tolerance remains rejected '.gettype($invalid));}
|
||||
echo "TOTAL $count checks passed; synthetic snapshots only.\n";
|
||||
|
||||
Reference in New Issue
Block a user