test_rust.c 588 B

12345678910111213141516171819202122232425262728293031
  1. /* Copyright (c) 2017, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #include "orconfig.h"
  4. #include "compat_rust.h"
  5. #include "test.h"
  6. #include "util.h"
  7. static void
  8. test_welcome_string(void *arg)
  9. {
  10. (void)arg;
  11. rust_str_t s = rust_welcome_string();
  12. const char *c_str = rust_str_get(s);
  13. tt_assert(c_str);
  14. size_t len = strlen(c_str);
  15. #ifdef HAVE_RUST
  16. tt_assert(len > 0);
  17. #else
  18. tt_assert(len == 0);
  19. #endif
  20. done:
  21. rust_str_free(s);
  22. }
  23. struct testcase_t rust_tests[] = {
  24. { "welcome_string", test_welcome_string, 0, NULL, NULL },
  25. END_OF_TESTCASES
  26. };