Sha256: 4c758ffa0976823cc95d88760d8067a8d4f68c2073c6723646abc2f09ac12f08

Contents?: true

Size: 995 Bytes

Versions: 6

Compression:

Stored size: 995 Bytes

Contents

#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#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

FILE *fp_res;
int   xmain(void);

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

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    if (xmain() != 0) {
        return 99;
    }
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rbnacl-libsodium-0.7.0 vendor/libsodium/test/default/cmptest.h
rbnacl-libsodium-0.6.1 vendor/libsodium/test/default/cmptest.h
rbnacl-libsodium-0.6.0 vendor/libsodium/test/default/cmptest.h
rbnacl-libsodium-0.5.0.1 vendor/libsodium/test/default/cmptest.h
rbnacl-libsodium-0.5.0.1.pre vendor/libsodium/test/default/cmptest.h
rbnacl-libsodium-0.5.0 vendor/libsodium/test/default/cmptest.h