test_token.c 491 B

1234567891011121314151617181920212223
  1. #include "si_test.h"
  2. #include "si_wire.h"
  3. #include "raku_token.h"
  4. TEST_FUNC(token) {
  5. SiWire * wire = siwire_new("Hello");
  6. RakuToken * tok = rakutoken_new(RakuTokenString, wire, 10, 3);
  7. TEST_NOTNULL(tok);
  8. TEST_INTEQ(rakutoken_line(tok), 10);
  9. TEST_INTEQ(rakutoken_col(tok), 3);
  10. TEST_ASSERT(siwire_equalcstr_p(rakutoken_value(tok), "Hello"));
  11. rakutoken_free(tok);
  12. siwire_free(wire);
  13. TEST_DONE();
  14. }
  15. int main(void) {
  16. TEST_INIT();
  17. TEST_RUN(token);
  18. TEST_REPORT();
  19. }