don't pull in namespace std
This commit is contained in:
parent
90386f63fe
commit
a59844be98
@ -31,10 +31,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
debug::backtrace::backtrace (void):
|
debug::backtrace::backtrace (void):
|
||||||
m_frames (DEFAULT_DEPTH) {
|
m_frames (DEFAULT_DEPTH) {
|
||||||
|
|
||||||
@ -49,7 +46,7 @@ debug::backtrace::backtrace (void):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static std::string
|
static std::string
|
||||||
addr2line (const void *addr)
|
addr2line (const void *addr)
|
||||||
{
|
{
|
||||||
@ -74,7 +71,7 @@ addr2line (const void *addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
ostream&
|
ostream&
|
||||||
debug::operator <<(ostream &os, const debug::backtrace &rhs) {
|
debug::operator <<(ostream &os, const debug::backtrace &rhs) {
|
||||||
const auto frames = rhs.frames ();
|
const auto frames = rhs.frames ();
|
||||||
|
@ -19,18 +19,18 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
debug::backtrace::backtrace (void):
|
debug::backtrace::backtrace (void):
|
||||||
m_frames (DEFAULT_DEPTH)
|
m_frames (DEFAULT_DEPTH)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
ostream&
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
debug::operator <<(ostream &os, const debug::backtrace&) {
|
std::ostream&
|
||||||
os << "null backtrace";
|
debug::operator <<(std::ostream &os, const debug::backtrace&)
|
||||||
return os;
|
{
|
||||||
|
return os << "null_backtrace";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
48
float.cpp
48
float.cpp
@ -19,44 +19,48 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
/* Constructors */
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
ieee_float<E, S>::ieee_float (void)
|
ieee_float<E, S>::ieee_float (void)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
ieee_float<E, S>::ieee_float (floating_t _floating):
|
ieee_float<E, S>::ieee_float (floating_t _floating):
|
||||||
m_floating (_floating)
|
m_floating (_floating)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
|
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
|
||||||
m_bits (rhs.m_bits)
|
m_bits (rhs.m_bits)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
/* Classifiers */
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::is_zero (void) const {
|
ieee_float<E, S>::is_zero (void) const
|
||||||
|
{
|
||||||
return m_components.exponent == 0 &&
|
return m_components.exponent == 0 &&
|
||||||
m_components.significand == 0;
|
m_components.significand == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::is_subnormal (void) const {
|
ieee_float<E, S>::is_subnormal (void) const
|
||||||
|
{
|
||||||
return m_components.exponent == 0 &&
|
return m_components.exponent == 0 &&
|
||||||
m_components.significand != 0;
|
m_components.significand != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::is_inifinity (void) const {
|
ieee_float<E, S>::is_inifinity (void) const {
|
||||||
@ -64,6 +68,7 @@ ieee_float<E, S>::is_inifinity (void) const {
|
|||||||
m_components.significand == 0;
|
m_components.significand == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::is_nan (void) const {
|
ieee_float<E, S>::is_nan (void) const {
|
||||||
@ -71,6 +76,8 @@ ieee_float<E, S>::is_nan (void) const {
|
|||||||
m_components.significand != 0;
|
m_components.significand != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::operator==(floating_t _floating) const {
|
ieee_float<E, S>::operator==(floating_t _floating) const {
|
||||||
@ -90,25 +97,7 @@ ieee_float<E, S>::operator==(floating_t _floating) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
//template <unsigned int E, unsigned int S>
|
|
||||||
//bool
|
|
||||||
//ieee_float<E, S>::almost_equal (floating_t a,
|
|
||||||
// floating_t b) {
|
|
||||||
// // Static cast to avoid integer casting warnings when using uint16_t for half
|
|
||||||
// static const floating_t epsilon = static_cast<floating_t> (0.001);
|
|
||||||
// const floating_t diff = static_cast<floating_t> (std::fabs (a - b));
|
|
||||||
//
|
|
||||||
// // * Use an exact equality first so that infinities are not indirectly compared. This would generate NaNs in the diff.
|
|
||||||
// // * Do not use gte or lte. This stops an infinite from making infinities on both sides of the inequality.
|
|
||||||
// return exactly_equal (a, b) ||
|
|
||||||
// diff < epsilon * std::fabs (a) ||
|
|
||||||
// diff < epsilon * std::fabs (b);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::almost_equal (floating_t a,
|
ieee_float<E, S>::almost_equal (floating_t a,
|
||||||
@ -118,7 +107,8 @@ ieee_float<E, S>::almost_equal (floating_t a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Based on the cynus `AlmostEqual2sComplement`
|
//-----------------------------------------------------------------------------
|
||||||
|
// Based on the Cygnus `AlmostEqual2sComplement` function
|
||||||
template <unsigned int E, unsigned int S>
|
template <unsigned int E, unsigned int S>
|
||||||
bool
|
bool
|
||||||
ieee_float<E, S>::almost_equal (floating_t _a,
|
ieee_float<E, S>::almost_equal (floating_t _a,
|
||||||
@ -164,7 +154,7 @@ ieee_float<E, S>::almost_equal (floating_t _a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template class ieee_float< 5, 10>; // ieee_half
|
template class ieee_float< 5, 10>; // ieee_half
|
||||||
template class ieee_float< 8, 23>; // ieee_single;
|
template class ieee_float< 8, 23>; // ieee_single;
|
||||||
template class ieee_float<11, 52>; // ieee_double;
|
template class ieee_float<11, 52>; // ieee_double;
|
||||||
|
1
io.cpp
1
io.cpp
@ -31,7 +31,6 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace util;
|
using namespace util;
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
const ipv4::ip ipv4::ip::LOOPBACK (127, 0, 0, 1);
|
const ipv4::ip ipv4::ip::LOOPBACK (127, 0, 0, 1);
|
||||||
const ipv4::ip ipv4::ip::ANY ( 0, 0, 0, 0);
|
const ipv4::ip ipv4::ip::ANY ( 0, 0, 0, 0);
|
||||||
@ -142,6 +139,6 @@ ipv4::ip::ip (const std::string &data)
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
ipv4::ip
|
ipv4::ip
|
||||||
ipv4::ip::parse (const string &data)
|
ipv4::ip::parse (const std::string &data)
|
||||||
{ return ipv4::ip (data); }
|
{ return ipv4::ip (data); }
|
||||||
|
|
||||||
|
@ -29,12 +29,10 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
using net::address;
|
||||||
using namespace net;
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
const char* inet_ntop(int af, const void* src, char* dst, int size){
|
const char* inet_ntop(int af, const void* src, char* dst, int size){
|
||||||
struct sockaddr_in srcaddr;
|
struct sockaddr_in srcaddr;
|
||||||
@ -50,20 +48,22 @@ const char* inet_ntop(int af, const void* src, char* dst, int size){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <domain D>
|
template <net::domain D>
|
||||||
typename address<D>::port_type
|
typename address<D>::port_type
|
||||||
address<D>::port (void) const
|
address<D>::port (void) const
|
||||||
{ return m_port; }
|
{ return m_port; }
|
||||||
|
|
||||||
|
|
||||||
template <domain D>
|
//-----------------------------------------------------------------------------
|
||||||
|
template <net::domain D>
|
||||||
void
|
void
|
||||||
address<D>::set_port (const port_type &_port)
|
address<D>::set_port (const port_type &_port)
|
||||||
{ m_port = _port; }
|
{ m_port = _port; }
|
||||||
|
|
||||||
|
|
||||||
template <domain D>
|
//-----------------------------------------------------------------------------
|
||||||
|
template <net::domain D>
|
||||||
typename address<D>::ip_type
|
typename address<D>::ip_type
|
||||||
address<D>::resolve (const std::string &str) {
|
address<D>::resolve (const std::string &str) {
|
||||||
addrinfo hint;
|
addrinfo hint;
|
||||||
@ -81,19 +81,19 @@ address<D>::resolve (const std::string &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
namespace net {
|
namespace net {
|
||||||
template <>
|
template <>
|
||||||
address<domain::INET>::address (const sockaddr_type &addr):
|
address<net::domain::INET>::address (const sockaddr_type &addr):
|
||||||
m_ip (addr.sin_addr.s_addr),
|
m_ip (addr.sin_addr.s_addr),
|
||||||
m_mask (0),
|
m_mask (0),
|
||||||
m_port (ntoh (addr.sin_port))
|
m_port (ntoh (addr.sin_port))
|
||||||
{
|
{
|
||||||
CHECK (addr.sin_family == (int)domain::INET);
|
CHECK (addr.sin_family == (int)net::domain::INET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <domain D>
|
template <net::domain D>
|
||||||
address<D>::address (const std::string &_addr,
|
address<D>::address (const std::string &_addr,
|
||||||
port_type _port):
|
port_type _port):
|
||||||
m_ip (resolve (_addr)),
|
m_ip (resolve (_addr)),
|
||||||
@ -103,11 +103,11 @@ namespace net {
|
|||||||
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
address<domain::INET>::sockaddr_type
|
address<net::domain::INET>::sockaddr_type
|
||||||
address<domain::INET>::to_sockaddr (void) const {
|
address<net::domain::INET>::to_sockaddr (void) const {
|
||||||
sockaddr_type addr;
|
sockaddr_type addr;
|
||||||
|
|
||||||
addr.sin_family = (int)domain::INET;
|
addr.sin_family = (int)net::domain::INET;
|
||||||
addr.sin_port = hton (m_port);
|
addr.sin_port = hton (m_port);
|
||||||
addr.sin_addr.s_addr = m_ip.m_integer;
|
addr.sin_addr.s_addr = m_ip.m_integer;
|
||||||
|
|
||||||
@ -117,11 +117,11 @@ namespace net {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
std::string
|
std::string
|
||||||
address<domain::INET>::to_string (void) const {
|
address<net::domain::INET>::to_string (void) const {
|
||||||
char dest[INET_ADDRSTRLEN + 1];
|
char dest[INET_ADDRSTRLEN + 1];
|
||||||
sockaddr_type addr = to_sockaddr ();
|
sockaddr_type addr = to_sockaddr ();
|
||||||
|
|
||||||
if (NULL == inet_ntop ((int)domain::INET, &addr.sin_addr, dest, sizeof (dest)))
|
if (NULL == inet_ntop ((int)net::domain::INET, &addr.sin_addr, dest, sizeof (dest)))
|
||||||
net::error::throw_code ();
|
net::error::throw_code ();
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ namespace net {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool
|
bool
|
||||||
address<domain::INET>::operator ==(const address<domain::INET> &rhs) {
|
address<net::domain::INET>::operator ==(const address<net::domain::INET> &rhs) {
|
||||||
return m_ip == rhs.m_ip &&
|
return m_ip == rhs.m_ip &&
|
||||||
m_mask == rhs.m_mask &&
|
m_mask == rhs.m_mask &&
|
||||||
m_port == rhs.m_port;
|
m_port == rhs.m_port;
|
||||||
@ -137,7 +137,7 @@ namespace net {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
std::ostream&
|
std::ostream&
|
||||||
net::operator<< (std::ostream &os, const address<net::domain::INET> &addr) {
|
net::operator<< (std::ostream &os, const address<net::domain::INET> &addr) {
|
||||||
os << addr.to_string () << ":" << addr.port ();
|
os << addr.to_string () << ":" << addr.port ();
|
||||||
@ -145,23 +145,23 @@ net::operator<< (std::ostream &os, const address<net::domain::INET> &addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <> const address<domain::INET>
|
template <> const address<net::domain::INET>
|
||||||
address<domain::INET>::LOOPBACK ("127.0.0.1", 0);
|
address<net::domain::INET>::LOOPBACK ("127.0.0.1", 0);
|
||||||
|
|
||||||
template <> const address<domain::INET>
|
template <> const address<net::domain::INET>
|
||||||
address<domain::INET>::ANY ("0.0.0.0", 0);
|
address<net::domain::INET>::ANY ("0.0.0.0", 0);
|
||||||
|
|
||||||
namespace net {
|
namespace net {
|
||||||
template class address<domain::INET>;
|
template class address<net::domain::INET>;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//template <> const address<domain::INET6>
|
//template <> const address<net::domain::INET6>
|
||||||
//address<domain::INET6>::LOOPBACK ("::1", 0);
|
//address<net::domain::INET6>::LOOPBACK ("::1", 0);
|
||||||
//
|
//
|
||||||
//template <> const address<domain::INET6>
|
//template <> const address<net::domain::INET6>
|
||||||
//address<domain::INET6>::ANY ("::0", 0);
|
//address<net::domain::INET6>::ANY ("::0", 0);
|
||||||
//
|
//
|
||||||
//template class address<domain::INET6>;
|
//template class address<net::domain::INET6>;
|
||||||
|
|
||||||
|
@ -20,23 +20,22 @@
|
|||||||
#include "../cast.hpp"
|
#include "../cast.hpp"
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
using net::error;
|
||||||
using namespace std;
|
|
||||||
using namespace net;
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
net::error::error (const std::string &_what):
|
net::error::error (const std::string &_what):
|
||||||
runtime_error (_what)
|
runtime_error (_what)
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
net::error::error (int _code):
|
net::error::error (int _code):
|
||||||
runtime_error (strerror (_code))
|
runtime_error (strerror (_code))
|
||||||
{ CHECK (_code != 0); }
|
{ CHECK (_code != 0); }
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
std::string
|
std::string
|
||||||
net::error::code_to_string (int code) {
|
net::error::code_to_string (int code) {
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
@ -54,7 +53,7 @@ net::error::code_to_string (int code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
net::error::throw_code (int code) {
|
net::error::throw_code (int code) {
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
|
@ -5,15 +5,14 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
|
|
||||||
util::stream::null out;
|
util::stream::null out;
|
||||||
out << debug::backtrace() << endl;
|
out << debug::backtrace() << std::endl;
|
||||||
tap.noop ();
|
tap.noop ();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -8,10 +8,12 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static const char *ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
static const char *ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
static const struct {
|
static const struct {
|
||||||
uint32_t adler;
|
uint32_t adler;
|
||||||
uint16_t bsd;
|
uint16_t bsd;
|
||||||
@ -24,6 +26,7 @@ static const struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char**) {
|
main (int, char**) {
|
||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
test_double (util::TAP::logger &tap)
|
test_double (util::TAP::logger &tap)
|
||||||
{
|
{
|
||||||
@ -19,17 +18,17 @@ test_double (util::TAP::logger &tap)
|
|||||||
|
|
||||||
sized_test tests[] = {
|
sized_test tests[] = {
|
||||||
{ 0x3ff0000000000000, 1.0 },
|
{ 0x3ff0000000000000, 1.0 },
|
||||||
{ 0x3ff0000000000001, 1.0 + numeric_limits<double>::epsilon () },
|
{ 0x3ff0000000000001, 1.0 + std::numeric_limits<double>::epsilon () },
|
||||||
{ 0x3ff0000000000002, 1.0 + numeric_limits<double>::epsilon () * 2},
|
{ 0x3ff0000000000002, 1.0 + std::numeric_limits<double>::epsilon () * 2},
|
||||||
{ 0x4000000000000000, 2.0 },
|
{ 0x4000000000000000, 2.0 },
|
||||||
{ 0xc000000000000000, -2.0 },
|
{ 0xc000000000000000, -2.0 },
|
||||||
{ 0x0000000000000001, numeric_limits<double>::denorm_min () },
|
{ 0x0000000000000001, std::numeric_limits<double>::denorm_min () },
|
||||||
{ 0x0010000000000000, numeric_limits<double>::min () }, // min positive normal
|
{ 0x0010000000000000, std::numeric_limits<double>::min () }, // min positive normal
|
||||||
{ 0x7fefffffffffffff, numeric_limits<double>::max () }, // max
|
{ 0x7fefffffffffffff, std::numeric_limits<double>::max () }, // max
|
||||||
{ 0x0000000000000000, 0.0 },
|
{ 0x0000000000000000, 0.0 },
|
||||||
{ 0x8000000000000000, -0.0 },
|
{ 0x8000000000000000, -0.0 },
|
||||||
{ 0x7ff0000000000000, numeric_limits<double>::infinity() },
|
{ 0x7ff0000000000000, std::numeric_limits<double>::infinity() },
|
||||||
{ 0xfff0000000000000, -numeric_limits<double>::infinity() },
|
{ 0xfff0000000000000, -std::numeric_limits<double>::infinity() },
|
||||||
{ 0x3fd5555555555555, 1.0 / 3.0 }
|
{ 0x3fd5555555555555, 1.0 / 3.0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,6 +45,7 @@ test_double (util::TAP::logger &tap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void
|
void
|
||||||
test_single (util::TAP::logger &tap)
|
test_single (util::TAP::logger &tap)
|
||||||
{
|
{
|
||||||
@ -57,13 +57,13 @@ test_single (util::TAP::logger &tap)
|
|||||||
sized_test tests[] = {
|
sized_test tests[] = {
|
||||||
{ 0x3f800000, 1.0f },
|
{ 0x3f800000, 1.0f },
|
||||||
{ 0xc0000000, -2.0f },
|
{ 0xc0000000, -2.0f },
|
||||||
{ 0x7f7fffff, numeric_limits<float>::max () },
|
{ 0x7f7fffff, std::numeric_limits<float>::max () },
|
||||||
|
|
||||||
{ 0x00000000, 0.0f },
|
{ 0x00000000, 0.0f },
|
||||||
{ 0x80000000, -0.0f },
|
{ 0x80000000, -0.0f },
|
||||||
|
|
||||||
{ 0x7f800000, numeric_limits<float>::infinity () },
|
{ 0x7f800000, std::numeric_limits<float>::infinity () },
|
||||||
{ 0xff800000, -numeric_limits<float>::infinity () },
|
{ 0xff800000, -std::numeric_limits<float>::infinity () },
|
||||||
|
|
||||||
{ 0x3eaaaaab, 1.0f / 3.0f }
|
{ 0x3eaaaaab, 1.0f / 3.0f }
|
||||||
};
|
};
|
||||||
@ -81,6 +81,7 @@ test_single (util::TAP::logger &tap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// TODO: Use a more robust test like Chi-Square
|
// TODO: Use a more robust test like Chi-Square
|
||||||
void
|
void
|
||||||
test_bool (util::TAP::logger &tap)
|
test_bool (util::TAP::logger &tap)
|
||||||
@ -29,6 +28,7 @@ test_bool (util::TAP::logger &tap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// TODO: Use a more robust test like Kolmogorov-Smirnov
|
// TODO: Use a more robust test like Kolmogorov-Smirnov
|
||||||
void
|
void
|
||||||
test_float (util::TAP::logger &tap)
|
test_float (util::TAP::logger &tap)
|
||||||
@ -55,6 +55,7 @@ test_float (util::TAP::logger &tap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
int
|
int
|
||||||
main (int, char **) {
|
main (int, char **) {
|
||||||
util::TAP::logger tap;
|
util::TAP::logger tap;
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "coord/iostream.hpp"
|
||||||
|
#include "extent.hpp"
|
||||||
|
#include "region.hpp"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
||||||
|
util::point2u a { 0, 0 };
|
||||||
|
util::point2u b { 1, 1 };
|
||||||
|
util::region2u v { a, b };
|
||||||
|
std::cerr << v << '\n';
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user