Remove li_boost_array testcase

Too many problems, this attempt to use std::array typemaps for boost::array
isn't really working. Latest problem is clang compile failures on OSX.
This commit is contained in:
William S Fulton 2016-10-15 17:24:18 +01:00
commit f9ba371ee4
4 changed files with 0 additions and 213 deletions

View file

@ -259,7 +259,6 @@ CPP_TEST_CASES += \
langobj \
li_attribute \
li_attribute_template \
li_boost_array \
li_boost_shared_ptr \
li_boost_shared_ptr_bits \
li_boost_shared_ptr_template \

View file

@ -1,87 +0,0 @@
%module li_boost_array
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
// Hack to use the std::array support for boost::array.
// Is limited as it currently exposes some 'using' bugs in SWIG though.
// For example, the type system fails to see that pointers to std::array
// and pointers to boost::array are the same.
%{
#if __cplusplus >= 201103 || (defined(_MSC_VER) && _MSC_VER >= 1900)
// Use C++11 array as this is unfortunately sometimes included by <algorithm>
#include <array>
namespace boost {
using std::array;
}
#else
#include <boost/array.hpp>
namespace std {
using boost::array;
}
#endif
%}
namespace boost {
using std::array;
}
%ignore std::array::fill; // Some older versions of boost don't have this function
%include <std_array.i>
%template(ArrayInt6) std::array<int, 6>;
%inline %{
boost::array<int, 6> arrayOutVal() {
const signed char carray[] = { -2, -1, 0, 0, 1, 2 };
boost::array<int, 6> myarray;
for (size_t i=0; i<6; ++i) {
myarray[i] = carray[i];
}
return myarray;
}
boost::array<int, 6> & arrayOutRef() {
static boost::array<int, 6> a = { -2, -1, 0, 0, 1, 2 };
return a;
}
const boost::array<int, 6> & arrayOutConstRef() {
static boost::array<int, 6> a = { -2, -1, 0, 0, 1, 2 };
return a;
}
boost::array<int, 6> * arrayOutPtr() {
static boost::array<int, 6> a = { -2, -1, 0, 0, 1, 2 };
return &a;
}
boost::array<int, 6> arrayInVal(boost::array<int, 6> myarray) {
for (boost::array<int, 6>::iterator it = myarray.begin(); it!=myarray.end(); ++it) {
*it *= 10;
}
return myarray;
}
const boost::array<int, 6> & arrayInConstRef(const boost::array<int, 6> & myarray) {
static boost::array<int, 6> a = myarray;
for (boost::array<int, 6>::iterator it = a.begin(); it!=a.end(); ++it) {
*it *= 10;
}
return a;
}
void arrayInRef(boost::array<int, 6> & myarray) {
for (boost::array<int, 6>::iterator it = myarray.begin(); it!=myarray.end(); ++it) {
*it *= 10;
}
}
void arrayInPtr(boost::array<int, 6> * myarray) {
for (boost::array<int, 6>::iterator it = myarray->begin(); it!=myarray->end(); ++it) {
*it *= 10;
}
}
%}
#endif

View file

@ -1,55 +0,0 @@
from li_boost_array import *
import sys
def failed(a, b, msg):
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
def compare_sequences(a, b):
if len(a) != len(b):
failed(a, b, "different sizes")
for i in range(len(a)):
if a[i] != b[i]:
failed(a, b, "elements are different")
def compare_containers(pythonlist, swigarray):
compare_sequences(pythonlist, swigarray)
ps = [0, 1, 2, 3, 4, 5]
ai = ArrayInt6(ps)
compare_containers(ps, ai)
# Modify content
for i in range(len(ps)):
ps[i] = (ps[i] + 1) * 10
ai[i] = (ai[i] + 1) * 10
compare_containers(ps, ai)
# Empty
ai = ArrayInt6()
compare_containers([0, 0, 0, 0, 0, 0], ai)
# Check return
compare_containers(arrayOutVal(), [-2, -1, 0, 0, 1, 2])
compare_containers(arrayOutConstRef(), [-2, -1, 0, 0, 1, 2])
#compare_containers(arrayOutRef(), [-2, -1, 0, 0, 1, 2])
#compare_containers(arrayOutPtr(), [-2, -1, 0, 0, 1, 2])
# Check passing arguments
ai = arrayInVal([9, 8, 7, 6, 5, 4])
compare_containers(ai, [90, 80, 70, 60, 50, 40])
ai = arrayInConstRef([9, 8, 7, 6, 5, 4])
compare_containers(ai, [90, 80, 70, 60, 50, 40])
#ai = ArrayInt6([9, 8, 7, 6, 5, 4])
#arrayInRef(ai)
#compare_containers(ai, [90, 80, 70, 60, 50, 40])
#ai = ArrayInt6([9, 8, 7, 6, 5, 4])
#arrayInPtr(ai)
#compare_containers(ai, [90, 80, 70, 60, 50, 40])

View file

@ -1,70 +0,0 @@
#!/usr/bin/env ruby
#
# Put description here
#
#
#
#
#
require 'swig_assert'
require 'li_boost_array'
include Li_boost_array
def failed(a, b, msg)
raise RuntimeError, "#{msg} #{a} #{b}"
end
def compare_sequences(a, b)
if a.size != b.size
failed(a, b, "different sizes")
end
for i in 0..a.size-1
failed(a, b, "elements are different:") if a[i] != b[i]
end
end
def compare_containers(rubyarray, swigarray)
compare_sequences(rubyarray, swigarray)
end
ps = [0, 1, 2, 3, 4, 5]
ai = ArrayInt6.new(ps)
compare_containers(ps, ai)
# Modify content
for i in 0..ps.size-1
ps[i] = ps[i] * 10
ai[i] = ai[i] * 10
end
compare_containers(ps, ai)
# Empty
ai = ArrayInt6.new()
# Check return
compare_containers(arrayOutVal(), [-2, -1, 0, 0, 1, 2])
compare_containers(arrayOutConstRef(), [-2, -1, 0, 0, 1, 2])
#compare_containers(arrayOutRef(), [-2, -1, 0, 0, 1, 2])
#compare_containers(arrayOutPtr(), [-2, -1, 0, 0, 1, 2])
# Check passing arguments
ai = arrayInVal([9, 8, 7, 6, 5, 4])
compare_containers(ai, [90, 80, 70, 60, 50, 40])
ai = arrayInConstRef([9, 8, 7, 6, 5, 4])
compare_containers(ai, [90, 80, 70, 60, 50, 40])
#ai = ArrayInt6.new([9, 8, 7, 6, 5, 4])
#arrayInRef(ai)
#compare_containers(ai, [90, 80, 70, 60, 50, 40])
#ai = ArrayInt6.new([9, 8, 7, 6, 5, 4])
#arrayInPtr(ai)
#compare_containers(ai, [90, 80, 70, 60, 50, 40])