1
0

main.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #include <stdio.h>
  2. #include <string.h>
  3. #ifndef BOOL_PROP1
  4. # error Expected BOOL_PROP1
  5. #endif
  6. #ifndef BOOL_PROP2
  7. # error Expected BOOL_PROP2
  8. #endif
  9. #ifndef BOOL_PROP3
  10. # error Expected BOOL_PROP3
  11. #endif
  12. #ifndef STRING_PROP1
  13. # error Expected STRING_PROP1
  14. #endif
  15. #ifndef STRING_PROP2
  16. # error Expected STRING_PROP2
  17. #endif
  18. #ifndef STRING_PROP3
  19. # error Expected STRING_PROP3
  20. #endif
  21. #ifndef STATIC1_BOOL_PROP1
  22. # error Expected STATIC1_BOOL_PROP1
  23. #endif
  24. #ifndef STATIC1_STRING_PROP1
  25. # error Expected STATIC1_STRING_PROP1
  26. #endif
  27. #ifndef STATIC1_NUMBER_MAX_PROP3
  28. # error Expected STATIC1_NUMBER_MAX_PROP3
  29. #endif
  30. #ifndef STATIC1_NUMBER_MIN_PROP5
  31. # error Expected STATIC1_NUMBER_MIN_PROP5
  32. #endif
  33. #ifdef OBJECT1_BOOL_PROP1
  34. # error Unexpected OBJECT1_BOOL_PROP1
  35. #endif
  36. #ifdef OBJECT1_STRING_PROP1
  37. # error Unexpected OBJECT1_STRING_PROP1
  38. #endif
  39. #ifdef OBJECT1_NUMBER_MAX_PROP3
  40. # error Unexpected OBJECT1_NUMBER_MAX_PROP3
  41. #endif
  42. #ifdef OBJECT1_NUMBER_MIN_PROP5
  43. # error Unexpected OBJECT1_NUMBER_MIN_PROP5
  44. #endif
  45. #ifdef IFACE3_BOOL_PROP1
  46. # error Unexpected IFACE3_BOOL_PROP1
  47. #endif
  48. #ifdef IFACE3_STRING_PROP1
  49. # error Unexpected IFACE3_STRING_PROP1
  50. #endif
  51. #ifdef IFACE3_NUMBER_MAX_PROP3
  52. # error Unexpected IFACE3_NUMBER_MAX_PROP3
  53. #endif
  54. #ifdef IFACE3_NUMBER_MIN_PROP5
  55. # error Unexpected IFACE3_NUMBER_MIN_PROP5
  56. #endif
  57. #ifndef STATIC1_BOOL_PROP5
  58. # error Expected STATIC1_BOOL_PROP5
  59. #endif
  60. #ifndef STATIC1_STRING_PROP4
  61. # error Expected STATIC1_STRING_PROP4
  62. #endif
  63. #ifndef STATIC1_NUMBER_MIN_PROP6
  64. # error Expected STATIC1_NUMBER_MIN_PROP6
  65. #endif
  66. #ifndef STATIC1_NUMBER_MAX_PROP4
  67. # error Expected STATIC1_NUMBER_MAX_PROP4
  68. #endif
  69. #ifndef OBJECT1_BOOL_PROP5
  70. # error Expected OBJECT1_BOOL_PROP5
  71. #endif
  72. #ifndef OBJECT1_STRING_PROP4
  73. # error Expected OBJECT1_STRING_PROP4
  74. #endif
  75. #ifndef OBJECT1_NUMBER_MIN_PROP6
  76. # error Expected OBJECT1_NUMBER_MIN_PROP6
  77. #endif
  78. #ifndef OBJECT1_NUMBER_MAX_PROP4
  79. # error Expected OBJECT1_NUMBER_MAX_PROP4
  80. #endif
  81. #ifndef IFACE3_BOOL_PROP5
  82. # error Expected IFACE3_BOOL_PROP5
  83. #endif
  84. #ifndef IFACE3_STRING_PROP4
  85. # error Expected IFACE3_STRING_PROP4
  86. #endif
  87. #ifndef IFACE3_NUMBER_MIN_PROP6
  88. # error Expected IFACE3_NUMBER_MIN_PROP6
  89. #endif
  90. #ifndef IFACE3_NUMBER_MAX_PROP4
  91. # error Expected IFACE3_NUMBER_MAX_PROP4
  92. #endif
  93. template <bool test>
  94. struct CMakeStaticAssert;
  95. template <>
  96. struct CMakeStaticAssert<true>
  97. {
  98. };
  99. enum
  100. {
  101. NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>),
  102. NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>),
  103. NumericMaxTest3 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP3 == 3>),
  104. NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>),
  105. NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>),
  106. NumericMinTest3 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP3 == 0xA>),
  107. NumericMinTest4 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP4 == 0x10>),
  108. NumericMinTest5 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP5 == 5>)
  109. };
  110. #include "iface2.h"
  111. int foo();
  112. #ifdef _WIN32
  113. __declspec(dllimport)
  114. #endif
  115. int bar();
  116. int main(int argc, char** argv)
  117. {
  118. int result = 0;
  119. for (int i = 2; i < argc; i += 2) {
  120. if (strcmp(argv[i - 1], argv[i]) != 0) {
  121. fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i,
  122. argv[i - 1], argv[i]);
  123. result = 1;
  124. }
  125. }
  126. Iface2 if2;
  127. return result + if2.foo() + foo() + bar();
  128. }