by default no test
compiles
diff --git a/ccnx/sync-app-socket.h b/ccnx/sync-app-socket.h
index 07c0aa0..bb533a9 100644
--- a/ccnx/sync-app-socket.h
+++ b/ccnx/sync-app-socket.h
@@ -82,7 +82,7 @@
void fetchString(const std::string &prefix, const SeqNo &seq, CcnxWrapper::StringDataCallback callback, int retry = 0);
void fetchRaw(const std::string &prefix, const SeqNo &seq, CcnxWrapper::RawDataCallback callback, int retry = 0);
- void passCallback(std::vector<MissingDataInfo> &v) {m_newDataCallback(v, this);}
+ void passCallback(const std::vector<MissingDataInfo> &v) {m_newDataCallback(v, this);}
private:
uint32_t
diff --git a/test/test_app_socket.cc b/test/test_app_socket.cc
index 8a3f864..6a6e04a 100644
--- a/test/test_app_socket.cc
+++ b/test/test_app_socket.cc
@@ -49,11 +49,11 @@
// cout << str1 << ", " << str2 << endl;
}
- void fetchAll(vector<MissingDataInfo> &v, SyncAppSocket *socket) {
+ void fetchAll(const vector<MissingDataInfo> &v, SyncAppSocket *socket) {
int n = v.size();
for (int i = 0; i < n; i++) {
- SeqNo s = ++v[i].low;
- for(; s <= v[i].high; ++s) {
+ SeqNo s = v[i].low;
+ for(++s; s <= v[i].high; ++s) {
socket->fetchString(v[i].prefix, s, bind(&TestSocketApp::set, this, _1, _2));
}
}
diff --git a/test/test_sync_logic.cc b/test/test_sync_logic.cc
index 0d77cd0..2cfde28 100644
--- a/test/test_sync_logic.cc
+++ b/test/test_sync_logic.cc
@@ -44,7 +44,7 @@
{
}
- void wrapper (vector<MissingDataInfo> &v) {
+ void wrapper (const vector<MissingDataInfo> &v) {
int n = v.size();
for (int i = 0; i < n; i++) {
onUpdate (v[i].prefix, v[i].high, v[i].low);
diff --git a/wscript b/wscript
index 0bcb242..8c52b8b 100644
--- a/wscript
+++ b/wscript
@@ -8,6 +8,7 @@
opt.add_option('--log4cxx', action='store_true',default=False,dest='log4cxx',help='''Compile with log4cxx/native NS3 logging support''')
opt.add_option('--ns3', action='store_true',default=False,dest='ns3_enable',help='''Compile as NS-3 module''')
opt.add_option('--ns3-debug', action='store_true',default=False,dest='ns3_debug',help='''Link against debug NS3 libraries. Optimized version will be used otherwise''')
+ opt.add_option('--test', action='store_true',default=False,dest='_test',help='''build unit tests''')
opt.load('compiler_c')
opt.load('compiler_cxx')
opt.load('boost')
@@ -53,6 +54,9 @@
else:
conf.env.append_value('CXXFLAGS', ['-O3'])
+ if conf.options._test:
+ conf.define('_TEST', 1)
+
try:
conf.load('doxygen')
except:
@@ -145,13 +149,14 @@
)
# Unit tests
- unittests = bld.program (
- target="unit-tests",
- source = bld.path.ant_glob(['test/**/*.cc']),
- features=['cxx', 'cxxprogram'],
- use = 'BOOST_TEST sync',
- includes = ['model', 'ccnx', 'helper'],
- )
+ if bld.get_define("_TEST"):
+ unittests = bld.program (
+ target="unit-tests",
+ source = bld.path.ant_glob(['test/**/*.cc']),
+ features=['cxx', 'cxxprogram'],
+ use = 'BOOST_TEST sync',
+ includes = ['model', 'ccnx', 'helper'],
+ )
if bld.get_define ("HAVE_LOG4CXX"):
libsync.use += ' LOG4CXX'