<commit_before>#!/usr/bin/env perl

use v5.010;
use strict;
use warnings;

use lib '../perl';

use BookerTest qw(test_sql_statement clean_dir_sub run_tests fail booker_init
	          booker_create_session);
use Cwd;

my $HOME = $ENV{HOME};
my $cd = getcwd;

run_tests(
    { name  => "session in custom directory",
      pre   => [ sub { booker_init("../end-session/test-path") },
                 sub { booker_create_session("../end-session/test-path") }
	       ],
      cmd   => ["./booker-end-session", "-d", "test-path"],
      tests => [ test_sql_statement(
                    "counting special session users",
                    "test-path",
                    "SELECT COUNT(*) FROM session_user WHERE user = 'user'",
                    sub { $_[0]->[0] == 1 })
               ],
      clean => clean_dir_sub("test-path")
    },

    { name      => "double session end",
      pre       => [ \&booker_init, \&booker_create_session ],
      cmd       => ["./booker-end-session; " .
                    "./booker-end-session"],<commit_msg>Add normal case test<commit_after>#!/usr/bin/env perl

use v5.010;
use strict;
use warnings;

use lib '../perl';

use BookerTest qw(test_sql_statement clean_dir_sub run_tests fail booker_init
	          booker_create_session);
use Cwd;

my $HOME = $ENV{HOME};
my $cd = getcwd;

run_tests(
    { name  => "Normal session end",
      pre       => [ \&booker_init, \&booker_create_session ],
      cmd   => ["./booker-end-session"],
      tests => [ test_sql_statement(
                    "counting special session users",
                    "$HOME/.booker",
                    "SELECT COUNT(*) FROM session_user WHERE user = 'user'",
                    sub { $_[0]->[0] == 1 })
               ],
      clean => clean_dir_sub("$HOME/.booker")
    },


    { name  => "session in custom directory",
      pre   => [ sub { booker_init("../end-session/test-path") },
                 sub { booker_create_session("../end-session/test-path") }
	       ],
      cmd   => ["./booker-end-session", "-d", "test-path"],
      tests => [ test_sql_statement(
                    "counting special session users",
                    "test-path",
                    "SELECT COUNT(*) FROM session_user WHERE user = 'user'",
                    sub { $_[0]->[0] == 1 })
               ],
      clean => clean_dir_sub("test-path")
    },

    { name      => "double session end",
      pre       => [ \&booker_init, \&booker_create_session ],
      cmd       => ["./booker-end-session; " .
                    "./booker-end-session"],
{'fraction_non_alphanumeric': 0.15725963409887114, 'fraction_numerical': 0.006617360840794083, 'mean_word_length': 1.775377969762419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5312735', 'n_tokens_mistral': 823, 'n_tokens_neox': 790, 'n_words': 172}