Newer
Older
dub_jkp / test / cov-ctfe / test.d
@Per Nordlöw Per Nordlöw on 7 Jun 2022 193 bytes Add support for coverage at compile-time (CTFE)
  1. int f(int x)
  2. {
  3. return x + 1;
  4. }
  5.  
  6. int g(int x)
  7. {
  8. return x * 2;
  9. }
  10.  
  11. enum gResult = g(12); // execute g() at compile-time
  12.  
  13. int main(string[] args)
  14. {
  15. assert(f(11) + gResult == 36);
  16. return 0;
  17. }