mirror of https://github.com/swig/swig
Hook up cpp17_director_string_view testcase
Rename from director_string_view (since it requires C++17) and add it to the list of tests to run which I'd failed to do before.
This commit is contained in:
parent
1e761f3ea7
commit
f4fbfa65be
|
@ -655,6 +655,7 @@ CPP14_TEST_BROKEN = \
|
|||
|
||||
# C++17 test cases.
|
||||
CPP17_TEST_CASES += \
|
||||
cpp17_director_string_view \
|
||||
cpp17_enable_if_t \
|
||||
cpp17_hex_floating_literals \
|
||||
cpp17_nested_namespaces \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%module(directors="1") director_string_view;
|
||||
%module(directors="1") cpp17_director_string_view;
|
||||
|
||||
#if defined SWIGCSHARP || defined SWIGJAVA || defined SWIGLUA || defined SWIGPERL || defined SWIGPHP || defined SWIGPYTHON || defined SWIGRUBY
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using cpp17_director_string_viewNamespace;
|
||||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
runme r = new runme();
|
||||
r.run();
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
String s;
|
||||
|
||||
cpp17_director_string_view_A c = new cpp17_director_string_view_A("hi");
|
||||
for (int i=0; i<3; i++) {
|
||||
s = c.call_get(i);
|
||||
Object ii = i;
|
||||
if (s != ii.ToString()) throw new Exception("cpp17_director_string_view_A.get(" + i + ") failed. Got:" + s);
|
||||
}
|
||||
|
||||
cpp17_director_string_view_B b = new cpp17_director_string_view_B("hello");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (s != "cpp17_director_string_view_B.get_first") throw new Exception("call_get_first() failed");
|
||||
|
||||
s = b.call_get(0);
|
||||
if (s != "cpp17_director_string_view_B.get: hello") throw new Exception("get(0) failed");
|
||||
}
|
||||
}
|
||||
|
||||
class cpp17_director_string_view_B : A {
|
||||
public cpp17_director_string_view_B(String first) : base(first) {
|
||||
}
|
||||
public override String get_first() {
|
||||
return "cpp17_director_string_view_B.get_first";
|
||||
}
|
||||
|
||||
public override String get(int n) {
|
||||
return "cpp17_director_string_view_B.get: " + base.get(n);
|
||||
}
|
||||
}
|
||||
|
||||
class cpp17_director_string_view_A : A {
|
||||
public cpp17_director_string_view_A(String first) : base(first) {
|
||||
}
|
||||
public override String get(int n) {
|
||||
Object nn = n;
|
||||
return nn.ToString();
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
using System;
|
||||
using director_string_viewNamespace;
|
||||
|
||||
public class runme
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
runme r = new runme();
|
||||
r.run();
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
String s;
|
||||
|
||||
director_string_view_A c = new director_string_view_A("hi");
|
||||
for (int i=0; i<3; i++) {
|
||||
s = c.call_get(i);
|
||||
Object ii = i;
|
||||
if (s != ii.ToString()) throw new Exception("director_string_view_A.get(" + i + ") failed. Got:" + s);
|
||||
}
|
||||
|
||||
director_string_view_B b = new director_string_view_B("hello");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (s != "director_string_view_B.get_first") throw new Exception("call_get_first() failed");
|
||||
|
||||
s = b.call_get(0);
|
||||
if (s != "director_string_view_B.get: hello") throw new Exception("get(0) failed");
|
||||
}
|
||||
}
|
||||
|
||||
class director_string_view_B : A {
|
||||
public director_string_view_B(String first) : base(first) {
|
||||
}
|
||||
public override String get_first() {
|
||||
return "director_string_view_B.get_first";
|
||||
}
|
||||
|
||||
public override String get(int n) {
|
||||
return "director_string_view_B.get: " + base.get(n);
|
||||
}
|
||||
}
|
||||
|
||||
class director_string_view_A : A {
|
||||
public director_string_view_A(String first) : base(first) {
|
||||
}
|
||||
public override String get(int n) {
|
||||
Object nn = n;
|
||||
return nn.ToString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
|
||||
import cpp17_director_string_view.*;
|
||||
|
||||
public class cpp17_director_string_view_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("cpp17_director_string_view");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
String s;
|
||||
|
||||
cpp17_director_string_view_A c = new cpp17_director_string_view_A("hi");
|
||||
for (int i=0; i<3; i++) {
|
||||
s = c.call_get(i);
|
||||
if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("cpp17_director_string_view_A.get(" + i + ") failed. Got:" + s);
|
||||
}
|
||||
|
||||
cpp17_director_string_view_B b = new cpp17_director_string_view_B("hello");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (!s.equals("cpp17_director_string_view_B.get_first")) throw new RuntimeException("call_get_first() failed");
|
||||
|
||||
s = b.call_get(0);
|
||||
if (!s.equals("cpp17_director_string_view_B.get: hello")) throw new RuntimeException("get(0) failed");
|
||||
}
|
||||
}
|
||||
|
||||
class cpp17_director_string_view_B extends A {
|
||||
public cpp17_director_string_view_B(String first) {
|
||||
super(first);
|
||||
}
|
||||
public String get_first() {
|
||||
return "cpp17_director_string_view_B.get_first";
|
||||
}
|
||||
|
||||
public String get(int n) {
|
||||
return "cpp17_director_string_view_B.get: " + super.get(n);
|
||||
}
|
||||
}
|
||||
|
||||
class cpp17_director_string_view_A extends A {
|
||||
public cpp17_director_string_view_A(String first) {
|
||||
super(first);
|
||||
}
|
||||
public String get(int n) {
|
||||
return Integer.valueOf(n).toString();
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
|
||||
import director_string_view.*;
|
||||
|
||||
public class director_string_view_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("director_string_view");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
|
||||
String s;
|
||||
|
||||
director_string_view_A c = new director_string_view_A("hi");
|
||||
for (int i=0; i<3; i++) {
|
||||
s = c.call_get(i);
|
||||
if (!s.equals(Integer.valueOf(i).toString())) throw new RuntimeException("director_string_view_A.get(" + i + ") failed. Got:" + s);
|
||||
}
|
||||
|
||||
director_string_view_B b = new director_string_view_B("hello");
|
||||
|
||||
s = b.call_get_first();
|
||||
if (!s.equals("director_string_view_B.get_first")) throw new RuntimeException("call_get_first() failed");
|
||||
|
||||
s = b.call_get(0);
|
||||
if (!s.equals("director_string_view_B.get: hello")) throw new RuntimeException("get(0) failed");
|
||||
}
|
||||
}
|
||||
|
||||
class director_string_view_B extends A {
|
||||
public director_string_view_B(String first) {
|
||||
super(first);
|
||||
}
|
||||
public String get_first() {
|
||||
return "director_string_view_B.get_first";
|
||||
}
|
||||
|
||||
public String get(int n) {
|
||||
return "director_string_view_B.get: " + super.get(n);
|
||||
}
|
||||
}
|
||||
|
||||
class director_string_view_A extends A {
|
||||
public director_string_view_A(String first) {
|
||||
super(first);
|
||||
}
|
||||
public String get(int n) {
|
||||
return Integer.valueOf(n).toString();
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
BEGIN { use_ok 'director_string_view' }
|
||||
require_ok 'director_string_view';
|
||||
BEGIN { use_ok 'cpp17_director_string_view' }
|
||||
require_ok 'cpp17_director_string_view';
|
||||
|
||||
{
|
||||
package B;
|
||||
use base 'director_string_view::A';
|
||||
use base 'cpp17_director_string_view::A';
|
||||
our $in_first = 0;
|
||||
sub get_first { my($self) = @_;
|
||||
die "SUPER RESOLVE BAD" if $in_first;
|
|
@ -1,4 +1,4 @@
|
|||
from director_string_view import *
|
||||
from cpp17_director_string_view import *
|
||||
|
||||
|
||||
class B(A):
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
require 'swig_assert'
|
||||
|
||||
require 'director_string_view'
|
||||
require 'cpp17_director_string_view'
|
||||
|
||||
class B < Director_string_view::A
|
||||
class B < Cpp17_director_string_view::A
|
||||
|
||||
def initialize(some_string)
|
||||
super(some_string)
|
Loading…
Reference in New Issue