<commit_before>#include "parser.h"
#include "ast.h"
#include "tests.h"

void test_parse_number();

int main() {
    test_parse_number();
    return 0;
}

struct token *make_token(enum token_type tk_type, char* str, double dbl,
        int number) {
    struct token *tk = malloc(sizeof(struct token));
    tk->type = tk_type;
    if (tk_type == tok_dbl) {
        tk->value.dbl = dbl;
    } else if (tk_type == tok_number) {
        tk->value.num = number;
    } else {
        tk->value.string = str;
    }
    return tk;
}

void test_parse_number() {
    struct token_list *tkl = make_token_list();
    tkl.append(make_token(tok_number, NULL, 0.0, 42);
    struct ast_node *result = parse_number(tkl);
    EXPECT_EQ(result->val, tkl->head);<commit_msg>Fix bug in parser tests<commit_after>#include "parser.h"
#include "ast.h"
#include "tests.h"

void test_parse_number();

int main() {
    test_parse_number();
    return 0;
}

struct token *make_token(enum token_type tk_type, char* str, double dbl,
        int number) {
    struct token *tk = malloc(sizeof(struct token));
    tk->type = tk_type;
    if (tk_type == tok_dbl) {
        tk->value.dbl = dbl;
    } else if (tk_type == tok_number) {
        tk->value.num = number;
    } else {
        tk->value.string = str;
    }
    return tk;
}

void test_parse_number() {
    struct token_list *tkl = make_token_list();
    struct token *tk = make_token(tok_number, NULL, 0.0, 42);
    append_token_list(tkl, tk);
    struct ast_node *result = parse_number(tkl);
    EXPECT_EQ(result->val, tk);
{'fraction_non_alphanumeric': 0.13797549967762734, 'fraction_numerical': 0.006447453255963894, 'mean_word_length': 3.073490813648294, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '453954', 'n_tokens_mistral': 585, 'n_tokens_neox': 568, 'n_words': 134}