Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
test-kstrtox.c File Reference
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>

Go to the source code of this file.

Data Structures

struct  test_fail
 

Macros

#define for_each_test(i, test)   for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
 
#define DEFINE_TEST_FAIL(test)   const struct test_fail test[] __initconst
 
#define DECLARE_TEST_OK(type, test_type)
 
#define DEFINE_TEST_OK(type, test)   const type test[] __initconst
 
#define TEST_FAIL(fn, type, fmt, test)
 
#define TEST_OK(fn, type, fmt, test)
 

Functions

 module_init (test_kstrtox_init)
 
 MODULE_LICENSE ("Dual BSD/GPL")
 

Macro Definition Documentation

#define DECLARE_TEST_OK (   type,
  test_type 
)
Value:
test_type { \
const char *str; \
unsigned int base; \
type expected_res; \
}

Definition at line 16 of file test-kstrtox.c.

#define DEFINE_TEST_FAIL (   test)    const struct test_fail test[] __initconst

Definition at line 13 of file test-kstrtox.c.

#define DEFINE_TEST_OK (   type,
  test 
)    const type test[] __initconst

Definition at line 23 of file test-kstrtox.c.

#define for_each_test (   i,
  test 
)    for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)

Definition at line 5 of file test-kstrtox.c.

#define TEST_FAIL (   fn,
  type,
  fmt,
  test 
)
Value:
{ \
unsigned int i; \
const struct test_fail *t = &test[i]; \
int rv; \
\
tmp = 0; \
rv = fn(t->str, t->base, &tmp); \
if (rv >= 0) { \
WARN(1, "str '%s', base %u, expected -E, got %d/" fmt "\n", \
t->str, t->base, rv, tmp); \
continue; \
} \
} \
}

Definition at line 26 of file test-kstrtox.c.

#define TEST_OK (   fn,
  type,
  fmt,
  test 
)
Value:
{ \
unsigned int i; \
const typeof(test[0]) *t = &test[i]; \
int rv; \
\
rv = fn(t->str, t->base, &res); \
if (rv != 0) { \
WARN(1, "str '%s', base %u, expected 0/" fmt ", got %d\n", \
t->str, t->base, t->expected_res, rv); \
continue; \
} \
if (res != t->expected_res) { \
WARN(1, "str '%s', base %u, expected " fmt ", got " fmt "\n", \
t->str, t->base, t->expected_res, res); \
continue; \
} \
} \
}

Definition at line 45 of file test-kstrtox.c.

Function Documentation

module_init ( test_kstrtox_init  )
MODULE_LICENSE ( "Dual BSD/GPL"  )