Back to index

glibc  2.9
Defines | Functions | Variables
sha256c-test.c File Reference
#include <crypt.h>
#include <stdio.h>
#include <string.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define ntests   (sizeof (tests) / sizeof (tests[0]))
#define TIMEOUT   6
#define TEST_FUNCTION   do_test ()

Functions

static int do_test (void)

Variables

struct {
const char * salt
const char * input
const char * expected
tests []

Define Documentation

#define ntests   (sizeof (tests) / sizeof (tests[0]))

Definition at line 35 of file sha256c-test.c.

#define TEST_FUNCTION   do_test ()

Definition at line 61 of file sha256c-test.c.

#define TIMEOUT   6

Definition at line 60 of file sha256c-test.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 40 of file sha256c-test.c.

{
  int result = 0;
  int i;

  for (i = 0; i < ntests; ++i)
    {
      char *cp = crypt (tests[i].input, tests[i].salt);

      if (strcmp (cp, tests[i].expected) != 0)
       {
         printf ("test %d: expected \"%s\", got \"%s\"\n",
                i, tests[i].expected, cp);
         result = 1;
       }
    }

  return result;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]