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