#include "lease.hpp" #include "distance.hpp" #include #include #include int main(){ int checks=0; for(int w=2;w<45;++w)for(int h=2;h<31;++h){ yeorin4::RectangleSpectrum s(w,h); for(double M:{0.,.1,1.,3.,12.}){ auto a=s.at(M,.12);double m=0,e=0; for(int y=0;y1e-10||std::abs(a.energy-e/(w*h))>1e-9){std::fprintf(stderr,"spectrum mismatch\n");return 1;}++checks; } } yeorin4::Lease l;l.source=1;l.published=1;l.expires=2;l.a=16;l.energy=4;l.maximum=2;l.residual=10; yeorin4::Query q;q.source=1;q.now=1.2;auto r=yeorin4::revalidate(l,q); if(r.alpha!=1||std::abs(r.lower-28)>1e-12)return 2; volatile double sink=0;const int N=1000000; auto start=std::chrono::steady_clock::now(); for(int i=0;i(finish-start).count()/N; std::printf("{\"exact_spectrum_cases\":%d,\"lease_iterations\":%d,\"lease_nanoseconds_per_call\":%.6f,\"checksum\":%.6f,\"scope\":\"CPU arithmetic only, not end-to-end latency\"}\n",checks,N,ns,double(sink)); return 0; }