2016-01-02 03:02:34 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-01-12 22:44:02 -08:00
|
|
|
/** @file
|
|
|
|
|
* Contains global utility functions
|
|
|
|
|
*/
|
|
|
|
|
|
2014-08-08 17:05:49 -04:00
|
|
|
#include <stdint.h>
|
2014-07-28 16:25:37 -04:00
|
|
|
#include <string>
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
#define wpi_assert(condition) \
|
2015-06-30 15:01:20 -04:00
|
|
|
wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__)
|
2015-06-25 15:07:55 -04:00
|
|
|
#define wpi_assertWithMessage(condition, message) \
|
|
|
|
|
wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \
|
|
|
|
|
__FUNCTION__)
|
|
|
|
|
|
|
|
|
|
#define wpi_assertEqual(a, b) \
|
2015-06-30 15:01:20 -04:00
|
|
|
wpi_assertEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
|
2015-06-25 15:07:55 -04:00
|
|
|
#define wpi_assertEqualWithMessage(a, b, message) \
|
|
|
|
|
wpi_assertEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, __FUNCTION__)
|
|
|
|
|
|
|
|
|
|
#define wpi_assertNotEqual(a, b) \
|
2015-06-30 15:01:20 -04:00
|
|
|
wpi_assertNotEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__)
|
2015-06-25 15:07:55 -04:00
|
|
|
#define wpi_assertNotEqualWithMessage(a, b, message) \
|
|
|
|
|
wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \
|
|
|
|
|
__FUNCTION__)
|
|
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
bool wpi_assert_impl(bool conditionValue, const char* conditionText,
|
2016-09-06 00:01:45 -07:00
|
|
|
const char* message, const char* fileName, int lineNumber,
|
|
|
|
|
const char* funcName);
|
2016-05-20 17:30:37 -07:00
|
|
|
bool wpi_assertEqual_impl(int valueA, int valueB, const char* valueAString,
|
|
|
|
|
const char* valueBString, const char* message,
|
2016-09-06 00:01:45 -07:00
|
|
|
const char* fileName, int lineNumber,
|
2016-05-20 17:30:37 -07:00
|
|
|
const char* funcName);
|
|
|
|
|
bool wpi_assertNotEqual_impl(int valueA, int valueB, const char* valueAString,
|
|
|
|
|
const char* valueBString, const char* message,
|
2016-09-06 00:01:45 -07:00
|
|
|
const char* fileName, int lineNumber,
|
2016-05-20 17:30:37 -07:00
|
|
|
const char* funcName);
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
void wpi_suspendOnAssertEnabled(bool enabled);
|
|
|
|
|
|
2016-09-06 00:01:45 -07:00
|
|
|
int GetFPGAVersion();
|
2016-07-12 10:45:14 -07:00
|
|
|
int64_t GetFPGARevision();
|
2015-12-30 19:06:47 -08:00
|
|
|
uint64_t GetFPGATime();
|
2014-07-29 14:34:52 -04:00
|
|
|
bool GetUserButton();
|
2016-09-06 00:01:45 -07:00
|
|
|
std::string GetStackTrace(int offset);
|