Commit ae9af63c authored by Daniel Seither's avatar Daniel Seither

Extend multiple inheritance tests by C++ tests

* Rename listeners.djinni -> multiple_inheritance.djinni
* Rename DBListenerCallerTest.m -> DBMultipleInheritanceTests.m
* Rename DBListenerCallerTest -> DBObjcMultipleInheritanceTest
* Add DBCppMultipleInheritanceTest
parent 49018487
......@@ -10,4 +10,4 @@
@import "test.djinni"
@import "primtypes.djinni"
@import "constants.djinni"
@import "listeners.djinni"
@import "multiple_inheritance.djinni"
# Used for ObjC multiple inheritance tests
first_listener = interface +o {
first();
}
# Used for ObjC multiple inheritance tests
second_listener = interface +o {
second();
}
......@@ -15,3 +17,16 @@ listener_caller = interface +c {
callFirst();
callSecond();
}
# Used for C++ multiple inheritance tests
return_one = interface +c {
static get_instance(): return_one;
return_one(): i8;
}
# Used for C++ multiple inheritance tests
return_two = interface +c {
static get_instance(): return_two;
return_two(): i8;
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
namespace testsuite {
/** Used for ObjC multiple inheritance tests */
class FirstListener {
public:
virtual ~FirstListener() {}
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include <cstdint>
#include <memory>
namespace testsuite {
/** Used for C++ multiple inheritance tests */
class ReturnOne {
public:
virtual ~ReturnOne() {}
static std::shared_ptr<ReturnOne> get_instance();
virtual int8_t return_one() = 0;
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include <cstdint>
#include <memory>
namespace testsuite {
/** Used for C++ multiple inheritance tests */
class ReturnTwo {
public:
virtual ~ReturnTwo() {}
static std::shared_ptr<ReturnTwo> get_instance();
virtual int8_t return_two() = 0;
};
} // namespace testsuite
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
namespace testsuite {
/** Used for ObjC multiple inheritance tests */
class SecondListener {
public:
virtual ~SecondListener() {}
......
......@@ -12,7 +12,7 @@ djinni/user_token.djinni
djinni/test.djinni
djinni/primtypes.djinni
djinni/constants.djinni
djinni/listeners.djinni
djinni/multiple_inheritance.djinni
djinni/date.djinni
djinni/date.yaml
djinni/duration.djinni
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for ObjC multiple inheritance tests */
public abstract class FirstListener {
public abstract void first();
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for C++ multiple inheritance tests */
public abstract class ReturnOne {
public abstract byte returnOne();
@CheckForNull
public static native ReturnOne getInstance();
private static final class CppProxy extends ReturnOne
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public byte returnOne()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_returnOne(this.nativeRef);
}
private native byte native_returnOne(long _nativeRef);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for C++ multiple inheritance tests */
public abstract class ReturnTwo {
public abstract byte returnTwo();
@CheckForNull
public static native ReturnTwo getInstance();
private static final class CppProxy extends ReturnTwo
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public byte returnTwo()
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_returnTwo(this.nativeRef);
}
private native byte native_returnTwo(long _nativeRef);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
package com.dropbox.djinni.test;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/** Used for ObjC multiple inheritance tests */
public abstract class SecondListener {
public abstract void second();
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeFirstListener.hpp" // my header
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeListenerCaller.hpp" // my header
#include "NativeFirstListener.hpp"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeReturnOne.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnOne.hpp"
namespace djinni_generated {
NativeReturnOne::NativeReturnOne() : ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne>("com/dropbox/djinni/test/ReturnOne$CppProxy") {}
NativeReturnOne::~NativeReturnOne() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::ReturnOne>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnOne_getInstance(JNIEnv* jniEnv, jobject /*this*/)
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::testsuite::ReturnOne::get_instance();
return ::djinni::release(::djinni_generated::NativeReturnOne::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT jbyte JNICALL Java_com_dropbox_djinni_test_ReturnOne_00024CppProxy_native_1returnOne(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ReturnOne>(nativeRef);
auto r = ref->return_one();
return ::djinni::release(::djinni::I8::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include "djinni_support.hpp"
#include "return_one.hpp"
namespace djinni_generated {
class NativeReturnOne final : ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne> {
public:
using CppType = std::shared_ptr<::testsuite::ReturnOne>;
using CppOptType = std::shared_ptr<::testsuite::ReturnOne>;
using JniType = jobject;
using Boxed = NativeReturnOne;
~NativeReturnOne();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeReturnOne>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeReturnOne>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeReturnOne();
friend ::djinni::JniClass<NativeReturnOne>;
friend ::djinni::JniInterface<::testsuite::ReturnOne, NativeReturnOne>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeReturnTwo.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnTwo.hpp"
namespace djinni_generated {
NativeReturnTwo::NativeReturnTwo() : ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo>("com/dropbox/djinni/test/ReturnTwo$CppProxy") {}
NativeReturnTwo::~NativeReturnTwo() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::ReturnTwo>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_ReturnTwo_getInstance(JNIEnv* jniEnv, jobject /*this*/)
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::testsuite::ReturnTwo::get_instance();
return ::djinni::release(::djinni_generated::NativeReturnTwo::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
CJNIEXPORT jbyte JNICALL Java_com_dropbox_djinni_test_ReturnTwo_00024CppProxy_native_1returnTwo(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::ReturnTwo>(nativeRef);
auto r = ref->return_two();
return ::djinni::release(::djinni::I8::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
#include "djinni_support.hpp"
#include "return_two.hpp"
namespace djinni_generated {
class NativeReturnTwo final : ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo> {
public:
using CppType = std::shared_ptr<::testsuite::ReturnTwo>;
using CppOptType = std::shared_ptr<::testsuite::ReturnTwo>;
using JniType = jobject;
using Boxed = NativeReturnTwo;
~NativeReturnTwo();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeReturnTwo>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeReturnTwo>::get()._toJava(jniEnv, c)}; }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); }
private:
NativeReturnTwo();
friend ::djinni::JniClass<NativeReturnTwo>;
friend ::djinni::JniInterface<::testsuite::ReturnTwo, NativeReturnTwo>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "NativeSecondListener.hpp" // my header
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#pragma once
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "first_listener.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBFirstListener+Private.h"
#import "DBFirstListener.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
/** Used for ObjC multiple inheritance tests */
@protocol DBFirstListener
- (void)first;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "listener_caller.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBListenerCaller+Private.h"
#import "DBListenerCaller.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBListenerCaller;
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "return_one.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBReturnOne;
namespace djinni_generated {
class ReturnOne
{
public:
using CppType = std::shared_ptr<::testsuite::ReturnOne>;
using CppOptType = std::shared_ptr<::testsuite::ReturnOne>;
using ObjcType = DBReturnOne*;
using Boxed = ReturnOne;
static CppType toCpp(ObjcType objc);
static ObjcType fromCppOpt(const CppOptType& cpp);
static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBReturnOne+Private.h"
#import "DBReturnOne.h"
#import "DBReturnOne+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBReturnOne ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnOne>&)cppRef;
@end
@implementation DBReturnOne {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::ReturnOne>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnOne>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
+ (nullable DBReturnOne *)getInstance {
try {
auto r = ::testsuite::ReturnOne::get_instance();
return ::djinni_generated::ReturnOne::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
- (int8_t)returnOne {
try {
auto r = _cppRefHandle.get()->return_one();
return ::djinni::I8::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
namespace djinni_generated {
auto ReturnOne::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto ReturnOne::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBReturnOne>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBReturnOne;
/** Used for C++ multiple inheritance tests */
@interface DBReturnOne : NSObject
+ (nullable DBReturnOne *)getInstance;
- (int8_t)returnOne;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#include "return_two.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBReturnTwo;
namespace djinni_generated {
class ReturnTwo
{
public:
using CppType = std::shared_ptr<::testsuite::ReturnTwo>;
using CppOptType = std::shared_ptr<::testsuite::ReturnTwo>;
using ObjcType = DBReturnTwo*;
using Boxed = ReturnTwo;
static CppType toCpp(ObjcType objc);
static ObjcType fromCppOpt(const CppOptType& cpp);
static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBReturnTwo+Private.h"
#import "DBReturnTwo.h"
#import "DBReturnTwo+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBReturnTwo ()
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnTwo>&)cppRef;
@end
@implementation DBReturnTwo {
::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::ReturnTwo>> _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ReturnTwo>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
}
return self;
}
+ (nullable DBReturnTwo *)getInstance {
try {
auto r = ::testsuite::ReturnTwo::get_instance();
return ::djinni_generated::ReturnTwo::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
- (int8_t)returnTwo {
try {
auto r = _cppRefHandle.get()->return_two();
return ::djinni::I8::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
namespace djinni_generated {
auto ReturnTwo::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc->_cppRefHandle.get();
}
auto ReturnTwo::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::get_cpp_proxy<DBReturnTwo>(cpp);
}
} // namespace djinni_generated
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
@class DBReturnTwo;
/** Used for C++ multiple inheritance tests */
@interface DBReturnTwo : NSObject
+ (nullable DBReturnTwo *)getInstance;
- (int8_t)returnTwo;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#include "second_listener.hpp"
#include <memory>
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import "DBSecondListener+Private.h"
#import "DBSecondListener.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from listeners.djinni
// This file generated by Djinni from multiple_inheritance.djinni
#import <Foundation/Foundation.h>
/** Used for ObjC multiple inheritance tests */
@protocol DBSecondListener
- (void)second;
......
......@@ -7,6 +7,8 @@ djinni-output-temp/cpp/map_date_record.hpp
djinni-output-temp/cpp/first_listener.hpp
djinni-output-temp/cpp/second_listener.hpp
djinni-output-temp/cpp/listener_caller.hpp
djinni-output-temp/cpp/return_one.hpp
djinni-output-temp/cpp/return_two.hpp
djinni-output-temp/cpp/constant_record.hpp
djinni-output-temp/cpp/constants.hpp
djinni-output-temp/cpp/constants.cpp
......@@ -39,6 +41,8 @@ djinni-output-temp/java/MapDateRecord.java
djinni-output-temp/java/FirstListener.java
djinni-output-temp/java/SecondListener.java
djinni-output-temp/java/ListenerCaller.java
djinni-output-temp/java/ReturnOne.java
djinni-output-temp/java/ReturnTwo.java
djinni-output-temp/java/ConstantRecord.java
djinni-output-temp/java/Constants.java
djinni-output-temp/java/ConstantsInterface.java
......@@ -73,6 +77,10 @@ djinni-output-temp/jni/NativeSecondListener.hpp
djinni-output-temp/jni/NativeSecondListener.cpp
djinni-output-temp/jni/NativeListenerCaller.hpp
djinni-output-temp/jni/NativeListenerCaller.cpp
djinni-output-temp/jni/NativeReturnOne.hpp
djinni-output-temp/jni/NativeReturnOne.cpp
djinni-output-temp/jni/NativeReturnTwo.hpp
djinni-output-temp/jni/NativeReturnTwo.cpp
djinni-output-temp/jni/NativeConstantRecord.hpp
djinni-output-temp/jni/NativeConstantRecord.cpp
djinni-output-temp/jni/NativeConstants.hpp
......@@ -122,6 +130,8 @@ djinni-output-temp/objc/DBMapDateRecord.mm
djinni-output-temp/objc/DBFirstListener.h
djinni-output-temp/objc/DBSecondListener.h
djinni-output-temp/objc/DBListenerCaller.h
djinni-output-temp/objc/DBReturnOne.h
djinni-output-temp/objc/DBReturnTwo.h
djinni-output-temp/objc/DBConstantRecord.h
djinni-output-temp/objc/DBConstantRecord.mm
djinni-output-temp/objc/DBConstants.h
......@@ -170,6 +180,10 @@ djinni-output-temp/objc/DBSecondListener+Private.h
djinni-output-temp/objc/DBSecondListener+Private.mm
djinni-output-temp/objc/DBListenerCaller+Private.h
djinni-output-temp/objc/DBListenerCaller+Private.mm
djinni-output-temp/objc/DBReturnOne+Private.h
djinni-output-temp/objc/DBReturnOne+Private.mm
djinni-output-temp/objc/DBReturnTwo+Private.h
djinni-output-temp/objc/DBReturnTwo+Private.mm
djinni-output-temp/objc/DBConstantRecord+Private.h
djinni-output-temp/objc/DBConstantRecord+Private.mm
djinni-output-temp/objc/DBConstants+Private.h
......
#include "return_one.hpp"
#include "return_two.hpp"
namespace testsuite {
class ReturnOneTwo : public ReturnOne, public ReturnTwo {
public:
static std::shared_ptr<ReturnOneTwo> shared_instance() {
static auto instance = std::make_shared<ReturnOneTwo>();
return instance;
}
int8_t return_one() override { return 1; }
int8_t return_two() override { return 2; }
};
std::shared_ptr<ReturnOne> ReturnOne::get_instance() {
return ReturnOneTwo::shared_instance();
}
std::shared_ptr<ReturnTwo> ReturnTwo::get_instance() {
return ReturnOneTwo::shared_instance();
}
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "DBFirstListener.h"
#include "DBSecondListener.h"
#include "DBListenerCaller.h"
#include "DBReturnOne.h"
#include "DBReturnTwo.h"
@interface Listener : NSObject <DBFirstListener, DBSecondListener>
@property bool firstCalled;
......@@ -30,11 +32,11 @@
@end
@interface DBListenerCallerTest : XCTestCase
// test instance of ObjC class implementing two +o interfaces, passed to C++
@interface DBObjcMultipleInheritanceTest : XCTestCase
@end
@implementation DBListenerCallerTest {
@implementation DBObjcMultipleInheritanceTest {
Listener *listener;
DBListenerCaller *caller;
}
......@@ -56,3 +58,21 @@
}
@end
// test instance of C++ class implementing two +c interfaces, used in ObjC
@interface DBCppMultipleInheritanceTest : XCTestCase
@end
@implementation DBCppMultipleInheritanceTest
- (void)testReturnOne {
DBReturnOne *returnOne = [DBReturnOne getInstance];
XCTAssertEqual([returnOne returnOne], 1);
}
- (void)testReturnTwo {
DBReturnTwo *returnTwo = [DBReturnTwo getInstance];
XCTAssertEqual([returnTwo returnTwo], 2);
}
@end
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment