dm: i2c: Add tests for I2C

Add some basic tests to check that the system works as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Simon Glass
2014-12-10 08:55:55 -07:00
parent 20142019a9
commit ecc2ed55ee
4 changed files with 246 additions and 0 deletions

View File

@@ -89,6 +89,18 @@ void ut_failf(struct dm_test_state *dms, const char *fname, int line,
} \
}
/* Assert that a pointer is not NULL */
#define ut_assertnonnull(expr) { \
const void *val = (expr); \
\
if (val == NULL) { \
ut_failf(dms, __FILE__, __LINE__, __func__, \
#expr " = NULL", \
"Expected non-null, got NULL"); \
return -1; \
} \
}
/* Assert that an operation succeeds (returns 0) */
#define ut_assertok(cond) ut_asserteq(0, cond)