This source file includes following definitions.
- TEST
- MustUseReturnedResult
- TEST
- TEST
#include "mojo/public/c/system/macros.h"
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace {
TEST(MacrosTest, AllowUnused) {
int x MOJO_ALLOW_UNUSED = 123;
}
int MustUseReturnedResult() MOJO_WARN_UNUSED_RESULT;
int MustUseReturnedResult() {
return 456;
}
TEST(MacrosTest, WarnUnusedResult) {
if (!MustUseReturnedResult())
abort();
}
MOJO_COMPILE_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t),
bad_compile_assert_failure_in_global_scope);
TEST(MacrosTest, CompileAssert) {
MOJO_COMPILE_ASSERT(sizeof(int32_t) == 2 * sizeof(int16_t),
bad_compile_assert_failure);
}
}
}