<commit_before>
#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include "sodium.h"
#include "quirks.h"

#ifdef __EMSCRIPTEN__
# undef TEST_SRCDIR
# define TEST_SRCDIR "/test-data"
#endif
#ifndef TEST_SRCDIR
# define TEST_SRCDIR "."
#endif

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

int xmain(void);

#ifdef BENCHMARKS

# include <sys/time.h>

# ifndef ITERATIONS
#  define ITERATIONS 128
# endif

static unsigned long long now(void)
{
    struct             timeval tp;
    unsigned long long now;

    if (gettimeofday(&tp, NULL) != 0) {
        abort();
    }
    now = ((unsigned long long) tp.tv_sec * 1000000ULL) +
        (unsigned long long) tp.tv_usec;

    return now;
}

int main(void)
{
    unsigned long long ts_start;
    unsigned long long ts_end;
    unsigned int       i;

    if (sodium_init() != 0) {
        return 99;
    }
    randombytes_set_implementation(&randombytes_salsa20_implementation);
    ts_start = now();
    for (i = 0; i < ITERATIONS; i++) {
        if (xmain() != 0) {
            abort();
        }
    }
    ts_end = now();
    printf("%llu\n", ts_end - ts_start);

    return 0;
}

#define printf(...) do { } while(0)

#elif !defined(BROWSER_TESTS)

FILE *fp_res;

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {<commit_msg>Bench: don't tie the printed result to the number of iterations<commit_after>
#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include "sodium.h"
#include "quirks.h"

#ifdef __EMSCRIPTEN__
# undef TEST_SRCDIR
# define TEST_SRCDIR "/test-data"
#endif
#ifndef TEST_SRCDIR
# define TEST_SRCDIR "."
#endif

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

int xmain(void);

#ifdef BENCHMARKS

# include <sys/time.h>

# ifndef ITERATIONS
#  define ITERATIONS 128
# endif

static unsigned long long now(void)
{
    struct             timeval tp;
    unsigned long long now;

    if (gettimeofday(&tp, NULL) != 0) {
        abort();
    }
    now = ((unsigned long long) tp.tv_sec * 1000000ULL) +
        (unsigned long long) tp.tv_usec;

    return now;
}

int main(void)
{
    unsigned long long ts_start;
    unsigned long long ts_end;
    unsigned int       i;

    if (sodium_init() != 0) {
        return 99;
    }
    randombytes_set_implementation(&randombytes_salsa20_implementation);
    ts_start = now();
    for (i = 0; i < ITERATIONS; i++) {
        if (xmain() != 0) {
            abort();
        }
    }
    ts_end = now();
    printf("%llu\n", 1000000ULL * (ts_end - ts_start) / ITERATIONS);

    return 0;
}

#define printf(...) do { } while(0)

#elif !defined(BROWSER_TESTS)

FILE *fp_res;

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
{'fraction_non_alphanumeric': 0.1320049813200498, 'fraction_numerical': 0.015877957658779578, 'mean_word_length': 3.0568181818181817, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '7021640', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1216, 'n_words': 310}