Restructure the project to match new modular layout.

This commit is contained in:
Rene Rivera
2012-12-28 22:25:52 -06:00
parent 7f08aede99
commit dbb5965186
150 changed files with 5 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
# Copyright Redshift Software, Inc. 2011
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
project test
: requirements
<include>$(BOOST_PREDEF_ROOT)/include
<dependency>$(BOOST_PREDEF_ROOT)/include/boost/predef.h
;
using testing ;
test-suite config :
[ run info_as_cpp.cpp : : : <test-info>always_show_run_output ]
[ run info_as_c.c : : : <test-info>always_show_run_output ]
[ run info_as_objcpp.mm : : : <test-info>always_show_run_output ]
[ run info_as_objc.m : : : <test-info>always_show_run_output ]
[ run version.cpp ]
[ run make.cpp ]
;
+76
View File
@@ -0,0 +1,76 @@
/*
Copyright Redshift Software Inc. 2011-2012
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define BOOST_PREDEF_INTERNAL_GENERATE_TESTS
typedef struct predef_info
{
unsigned tag;
char * name;
char * description;
unsigned value;
} predef_info;
predef_info first_predef_info = { 0x43210DEF , "-" , "-" , 0xFFFFFFFF };
#define BOOST_PREDEF_DECLARE_TEST(x,s) \
predef_info x##_predef_info = { 0x67890DEF , #x , s , x };
#include <boost/predef.h>
predef_info last_predef_info = { 0xFFFFFFFF , "-" , "-" , 0x43210DEF };
int predef_info_compare(const void * a, const void * b)
{
const predef_info ** i = (const predef_info **)a;
const predef_info ** j = (const predef_info **)b;
return strcmp((*i)->name,(*j)->name);
}
int main()
{
unsigned x = 0;
predef_info ** predefs = 0;
unsigned predef_count = 0;
unsigned * i = &first_predef_info.tag;
unsigned * e = &last_predef_info.tag;
while (i < e)
{
i += 1;
if (*i == 0x67890DEF)
{
predef_count += 1;
predefs = realloc(predefs,predef_count*sizeof(predef_info*));
predefs[predef_count-1] = (predef_info*)i;
}
}
qsort(predefs,predef_count,sizeof(predef_info*),predef_info_compare);
puts("** Detected **");
for (x = 0; x < predef_count; ++x)
{
if (predefs[x]->value > 0)
printf("%s = %u (%u,%u,%u) | %s\n",
predefs[x]->name,
predefs[x]->value,
(predefs[x]->value/10000000)%100,
(predefs[x]->value/100000)%100,
(predefs[x]->value)%100000,
predefs[x]->description);
}
puts("** Not Detected **");
for (x = 0; x < predef_count; ++x)
{
if (predefs[x]->value == 0)
printf("%s = %u | %s\n",
predefs[x]->name,
predefs[x]->value,
predefs[x]->description);
}
return 0;
}
+90
View File
@@ -0,0 +1,90 @@
/*
Copyright Redshift Software Inc. 2011-2012
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <string>
#include <iostream>
#include <set>
#define BOOST_PREDEF_INTERNAL_GENERATE_TESTS
namespace
{
struct predef_info
{
std::string name;
std::string description;
unsigned value;
predef_info(
std::string const & n,
std::string const & d,
unsigned v);
predef_info(
predef_info const & other)
: name(other.name)
, description(other.description)
, value(other.value)
{
}
bool operator < (predef_info const & other) const
{
return name < other.name;
}
};
std::set<predef_info> * predefs = 0;
predef_info::predef_info(
std::string const & n,
std::string const & d,
unsigned v)
: name(n)
, description(d)
, value(v)
{
if (!predefs)
{
predefs = new std::set<predef_info>();
}
predefs->insert(*this);
}
}
#define BOOST_PREDEF_DECLARE_TEST(x,s) \
namespace { \
predef_info x##_predef_init(#x,s,x); \
}
#include <boost/predef.h>
int main()
{
std::set<predef_info>::iterator i;
std::set<predef_info>::iterator e = predefs->end();
std::cout << "** Detected **" << std::endl;
for (i = predefs->begin(); i != e; ++i)
{
if (i->value > 0)
std::cout
<< i->name << " = "
<< i->value
<< " (" << (i->value/10000000)%100 << "," << (i->value/100000)%100 << "," << (i->value)%100000 << ") | "
<< i->description
<< std::endl;
}
std::cout << "** Not Detected **" << std::endl;
for (i = predefs->begin(); i != e; ++i)
{
if (i->value == 0)
std::cout
<< i->name << " = "
<< i->value << " | "
<< i->description
<< std::endl;
}
return 0;
}
+7
View File
@@ -0,0 +1,7 @@
/*
Copyright Redshift Software Inc. 2011
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include "info_as_c.c"
+7
View File
@@ -0,0 +1,7 @@
/*
Copyright Redshift Software Inc. 2011
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include "info_as_cpp.cpp"
+82
View File
@@ -0,0 +1,82 @@
/*
Copyright Redshift Software Inc 2011-2012
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/predef/version_number.h>
#include <boost/predef/make.h>
#include <exception>
#include <vector>
#include <string>
#include <iostream>
namespace
{
struct test_info
{
std::string value;
bool passed;
test_info(std::string const & v, bool p) : value(v), passed(p) {}
test_info(test_info const & o) : value(o.value), passed(o.passed) {}
};
std::vector<test_info> test_results;
}
#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X)))
void test_BOOST_VERSION_NUMBER()
{
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRP(0xFFF) == BOOST_VERSION_NUMBER(0xF,0xF,0xF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRP(0xFFFF) == BOOST_VERSION_NUMBER(0xFF,0xF,0xF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRPP(0xFFFF) == BOOST_VERSION_NUMBER(0xF,0xF,0xFF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRR(0xFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0x0));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPPPP(0xFFFFFFF) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFFFF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VVRRP(0xFFFFF) == BOOST_VERSION_NUMBER(0xFF,0xFF,0xF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_0X_VRRPP000(0xFFFFF000) == BOOST_VERSION_NUMBER(0xF,0xFF,0xFF));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRP(999) == BOOST_VERSION_NUMBER(9,9,9));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VPPP(9999) == BOOST_VERSION_NUMBER(9,0,999));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRRPP(999999) == BOOST_VERSION_NUMBER(99,99,99));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR(9999) == BOOST_VERSION_NUMBER(99,99,0));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRPP(9999) == BOOST_VERSION_NUMBER(9,9,99));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRRPP(99999) == BOOST_VERSION_NUMBER(9,99,99));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRP000(999000) == BOOST_VERSION_NUMBER(9,9,9));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRR000(999000) == BOOST_VERSION_NUMBER(9,99,0));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR00PP00(9999009900) == BOOST_VERSION_NUMBER(99,99,99));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR0PP00(999909900) == BOOST_VERSION_NUMBER(99,99,99));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VV00(9900) == BOOST_VERSION_NUMBER(99,00,00));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VVRR0PPPP(999909999) == BOOST_VERSION_NUMBER(99,99,9999));
PREDEF_CHECK(BOOST_PREDEF_MAKE_10_VRR(999) == BOOST_VERSION_NUMBER(9,99,00));
PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19700101) == BOOST_VERSION_NUMBER(0,1,1));
PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(19710101) == BOOST_VERSION_NUMBER(1,1,1));
PREDEF_CHECK(BOOST_PREDEF_MAKE_YYYYMMDD(20691231) == BOOST_VERSION_NUMBER(99,12,31));
}
int main()
{
test_BOOST_VERSION_NUMBER();
unsigned fail_count = 0;
std::vector<test_info>::iterator i = test_results.begin();
std::vector<test_info>::iterator e = test_results.end();
for (; i != e; ++i)
{
std::cout
<< (i->passed ? "[passed]" : "[failed]")
<< " " << i->value
<< std::endl;
fail_count += i->passed ? 0 : 1;
}
std::cout
<< std::endl
<< "TOTAL: "
<< "passed " << (test_results.size()-fail_count) << ", "
<< "failed " << (fail_count) << ", "
<< "of " << (test_results.size())
<< std::endl;
return fail_count;
}
+62
View File
@@ -0,0 +1,62 @@
/*
Copyright Redshift Software Inc 2011-2012
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <boost/predef/version_number.h>
#include <exception>
#include <vector>
#include <string>
#include <iostream>
namespace
{
struct test_info
{
std::string value;
bool passed;
test_info(std::string const & v, bool p) : value(v), passed(p) {}
test_info(test_info const & o) : value(o.value), passed(o.passed) {}
};
std::vector<test_info> test_results;
}
#define PREDEF_CHECK(X) test_results.push_back(test_info(#X,(X)))
void test_BOOST_VERSION_NUMBER()
{
PREDEF_CHECK(BOOST_VERSION_NUMBER(0,0,1) == 1L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(99,99,99999) == 999999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(299,99,99999) != 2999999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) != 1009999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,99,99999) == 9999999L);
PREDEF_CHECK(BOOST_VERSION_NUMBER(100,100,100000) == 0L);
}
int main()
{
test_BOOST_VERSION_NUMBER();
unsigned fail_count = 0;
std::vector<test_info>::iterator i = test_results.begin();
std::vector<test_info>::iterator e = test_results.end();
for (; i != e; ++i)
{
std::cout
<< (i->passed ? "[passed]" : "[failed]")
<< " " << i->value
<< std::endl;
fail_count += i->passed ? 0 : 1;
}
std::cout
<< std::endl
<< "TOTAL: "
<< "passed " << (test_results.size()-fail_count) << ", "
<< "failed " << (fail_count) << ", "
<< "of " << (test_results.size())
<< std::endl;
return fail_count;
}