<?php
declare(strict_types=1);
// Fixed values derived from frozen StaffPower.php: male age36 weight60,
// getGeneralRee adult31-60 formula then explicit adult18-59 multiplier0.95.
// This test neither imports business services nor reads HTTP/database results.
$eq=static function(string $got,string $want):void{if($got!==$want)throw new RuntimeException($got.' != '.$want);};
$round=static function(string $v):string{return bcadd(bcadd($v,bccomp($v,'0',12)<0?'-0.005':'0.005',12),'0',2);};
$rawRee=bcmul(bcadd(bcmul('11.472','60',12),'873.1',12),'0.95',12);
$eq($rawRee,'1483.349000000000');$eq($round($rawRee),'1483.35');
$rawActivity=bcmul($rawRee,'1.65',12);$eq($rawActivity,'2447.525850000000');$eq($round($rawActivity),'2447.53');
$gain=$round(bcadd($rawActivity,bcmul('785','0.25',12),12));$eq($gain,'2643.78');$eq(bcadd($gain,'300',2),'2943.78');
$loss=$round(bcsub($rawActivity,'1100',12));$eq($loss,'1347.53');$eq(bcsub($loss,'300',2),'1047.53');
$clamp=bccomp(bcsub($loss,'300',2),'1200',2)<0?'1200.00':bcsub($loss,'300',2);$eq($clamp,'1200.00');
$eq($round(bcdiv(bcmul($clamp,'0.25',12),'9',12)),'33.33');
$eq($round('0.525'),'0.53');$eq($round('0.255'),'0.26');$eq($round('-1'),'-1.00');
$eq($round(bcmul('2345.67','0.525',12)),'1231.48');$eq($round(bcdiv(bcmul('2345.67','0.25',12),'9',12)),'65.16');
echo json_encode(['assertions'=>15,'all_passed'=>true,'source'=>'frozen getGeneralRee + getConsumePower + getNutrient formulas','business_code_or_database_called'=>false]),"\n";
