options.c 686 B

12345678910111213141516171819202122232425262728
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "options.pb.h"
  4. #include "unittests.h"
  5. int main()
  6. {
  7. int status = 0;
  8. {
  9. HasFieldMessage msg1 = HasFieldMessage_init_default;
  10. HasFieldMessage msg2 = HasFieldMessage_init_zero;
  11. COMMENT("Test default_has option");
  12. /* Default initializer should obey has_default setting */
  13. TEST(msg1.has_present == true);
  14. TEST(msg1.has_missing == false);
  15. TEST(msg1.has_normal == false);
  16. /* Zero initializer should always have false */
  17. TEST(msg2.has_present == false);
  18. TEST(msg2.has_missing == false);
  19. TEST(msg2.has_normal == false);
  20. }
  21. return status;
  22. }