macros.cc 788 B

1234567891011121314151617181920212223242526272829303132
  1. // -*- mode: c++; coding: utf-8 -*-
  2. // ra-ra/test - Test type list library based on tuples.
  3. // (c) Daniel Llorens - 2010
  4. // This library is free software; you can redistribute it and/or modify it under
  5. // the terms of the GNU Lesser General Public License as published by the Free
  6. // Software Foundation; either version 3 of the License, or (at your option) any
  7. // later version.
  8. #include <iostream>
  9. #include "ra/tuples.hh"
  10. using std::cout, std::endl;
  11. int main()
  12. {
  13. int errors = 0;
  14. int a = 0;
  15. #define ADDTHIS(x) a += x;
  16. FOR_EACH(ADDTHIS, 1, 2, 3);
  17. errors += (6!=a);
  18. a = 0;
  19. FOR_EACH(ADDTHIS, 7, 0);
  20. errors += (7!=a);
  21. a = 0;
  22. FOR_EACH(ADDTHIS, 3);
  23. errors += (3!=a);
  24. #undef ADDTHIS
  25. std::cout << errors << " errors" << endl;
  26. return errors;
  27. }