<commit_before>#include "tickit.h"
#include "taplib.h"

#include <string.h>

void output(TickitTerm *tt, const char *bytes, size_t len, void *user)
{
  char *buffer = user;
  strncat(buffer, bytes, len);
}

int main(int argc, char *argv[])
{
  TickitTerm *tt;
  char buffer[1024];

  plan_tests(7);

  tt = tickit_term_new_for_termtype("xterm");

  ok(!!tt, "tickit_term_new_for_termtype");

  tickit_term_set_output_func(tt, output, buffer);

  buffer[0] = 0;
  tickit_term_set_mode_altscreen(tt, 1);

  is_str_escape(buffer, "\e[?1049h", "buffer after set_mode_altscreen on");

  buffer[0] = 0;
  tickit_term_set_mode_altscreen(tt, 1);

  is_str_escape(buffer, "", "set_mode_altscreen a second time is idempotent");

  buffer[0] = 0;
  tickit_term_set_mode_cursorvis(tt, 0);

  is_str_escape(buffer, "\e[?25l", "buffer after set_mode_cursorvis off");

  buffer[0] = 0;
  tickit_term_set_mode_mouse(tt, 1);

  is_str_escape(buffer, "\e[?1002h\e[?1006h", "buffer after set_mode_mouse on");

  buffer[0] = 0;
  tickit_term_destroy(tt);

  ok(1, "tickit_term_destroy");
<commit_msg>Unit test the new term_setctl_int, rather than the deprecated set_mode_*<commit_after>#include "tickit.h"
#include "taplib.h"

#include <string.h>

void output(TickitTerm *tt, const char *bytes, size_t len, void *user)
{
  char *buffer = user;
  strncat(buffer, bytes, len);
}

int main(int argc, char *argv[])
{
  TickitTerm *tt;
  char buffer[1024];

  plan_tests(7);

  tt = tickit_term_new_for_termtype("xterm");

  ok(!!tt, "tickit_term_new_for_termtype");

  tickit_term_set_output_func(tt, output, buffer);

  buffer[0] = 0;
  tickit_term_setctl_int(tt, TICKIT_TERMCTL_ALTSCREEN, 1);

  is_str_escape(buffer, "\e[?1049h", "buffer after set_mode_altscreen on");

  buffer[0] = 0;
  tickit_term_setctl_int(tt, TICKIT_TERMCTL_ALTSCREEN, 1);

  is_str_escape(buffer, "", "set_mode_altscreen a second time is idempotent");

  buffer[0] = 0;
  tickit_term_setctl_int(tt, TICKIT_TERMCTL_CURSORVIS, 0);

  is_str_escape(buffer, "\e[?25l", "buffer after set_mode_cursorvis off");

  buffer[0] = 0;
  tickit_term_setctl_int(tt, TICKIT_TERMCTL_MOUSE, 1);

  is_str_escape(buffer, "\e[?1002h\e[?1006h", "buffer after set_mode_mouse on");

  buffer[0] = 0;
  tickit_term_destroy(tt);

  ok(1, "tickit_term_destroy");

{'fraction_non_alphanumeric': 0.1422959406372763, 'fraction_numerical': 0.02968136185072021, 'mean_word_length': 5.624277456647399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6296521', 'n_tokens_mistral': 1011, 'n_tokens_neox': 942, 'n_words': 183}