Sha256: 447421fcfabc978d1230b6b55fa22a367ef6fa6b5d623748c704757abf1cbd58

Contents?: true

Size: 702 Bytes

Versions: 7

Compression:

Stored size: 702 Bytes

Contents

#ifndef MARISA_ASSERT_H_
#define MARISA_ASSERT_H_

#include <iostream>
#include <cstdlib>

#define ASSERT(cond) (void)((!!(cond)) || \
  ((std::cout << __LINE__ << ": Assertion `" << #cond << "' failed." \
      << std::endl), std::exit(-1), 0))

#define EXCEPT(code, expected_error_code) try { \
  code; \
  std::cout << __LINE__ << ": Exception `" << #code << "' failed." \
      << std::endl; \
  std::exit(-1); \
} catch (const marisa::Exception &ex) { \
  ASSERT(ex.error_code() == expected_error_code); \
}

#define TEST_START() \
  (std::cout << __FILE__ << ":" << __LINE__ << ": " << __FUNCTION__ << "(): ")

#define TEST_END() \
  (std::cout << "ok" << std::endl)

#endif  // MARISA_ASSERT_H_

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
melisa-0.2.5 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.2.4 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.2.3 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.2.2 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.2.1 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.2.0 ext/marisa-0.2.4/tests/marisa-assert.h
melisa-0.1.0 ext/marisa/tests/marisa-assert.h