Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/dagsim/format_diff.c # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / dagsim / format_diff.c` 87 lines · 4979 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 * Read-only C formatting oracles retained from the migrated expressions. */ 3 #include "dagsim.h" 4 #include "dagsim_format.h" 5 #include 6 #include 7 int oracle_ds_day_from_date(const char *); 8 const char *oracle_ds_status_name(int); 9 const char *oracle_ds_prov_name(int); 10 static int checks, bad; 11 #define CHECK(x) do { checks++; if (!(x)) { fprintf(stderr,"format check line %d\n",__LINE__); bad++; } } while (0) 12 static void same(unsigned mode, uint64_t a[16], double expected) { 13 double got=ds_unbits(ds_decide(mode,a)); 14 CHECK((isnan(got)&&isnan(expected)) || ds_bits(got)==ds_bits(expected)); 15 } 16 int main(void) { 17 const char *dates[]={"1970-01-01","1969-12-31","2000-02-29","1900-03-01","2026-11-06","2026-0-0","2026-13-32","2026--1-1","2026-11-06junk","-1-1-1","2026-11","2026-11-x","+2026-+11-+6"}; 18 for (unsigned i=0;i0&&v[j]>0)); 49 CHECK(ds_decide(9,p)==(v[i]+1e-6>=v[j])); 50 same(17,p,v[i]-v[j]); same(19,p,v[j]>v[i]?v[j]:v[i]); 51 for (unsigned k=0;k=0?fabs(v[i]-v[j])*(v[k]>0?v[k]:0.05):0); 54 } 55 } 56 } 57 for (unsigned kind=1;kind<=4;kind++) for (unsigned prov=0;prov<=4;prov++) { 58 uint64_t w[16]={kind,ds_bits(10),ds_bits(8),ds_bits(12),prov}; 59 double width=kind==2?(12.0-8.0)/10.0:0; 60 if(prov==4) width=1; 61 same(15,w,width); 62 char s[256]; ds_fmt(12,w,s); CHECK(strlen(s)>0); 63 } 64 for (unsigned kind=1;kind<=6;kind++) for (unsigned has=0;has<=1;has++) { 65 uint64_t p[16]={kind,has,3}; CHECK(ds_decide(13,p)==(kind==3&&!has?2:3)); 66 } 67 for (unsigned m=0;m<=1;m++) for(unsigned syn=0;syn<=1;syn++) { 68 uint64_t a[16]={m,syn}; char s[256]; ds_fmt(10,a,s); 69 CHECK(!strcmp(s,m?"MEASURED":syn?"SYNTHETIC_SENSITIVITY_ONLY":"UNMEASURED")); 70 CHECK(ds_decide(11,a)==m); 71 } 72 for (unsigned i=0;i<3;i++) for(unsigned j=0;j<3;j++) for(unsigned e=0;e<2;e++) { 73 uint64_t a[16]={ds_bits(v[i]),ds_bits(v[j]),ds_bits(1),ds_bits(v[j]),ds_bits(v[i]),ds_bits(0),e}; 74 int le=v[j]<=v[i]&&v[i]<=v[j]&&(!e||0<=1); 75 int lt=v[j]