Commit 3c1ea5cb authored by Andrew Twyman's avatar Andrew Twyman Committed by Jacob Potter

Add a C++ Namespace to test-suite

parent 3e817fcb
......@@ -46,4 +46,6 @@ abstract class Marshal(spec: Spec) {
case Some("") => "::" + t
case Some(s) => "::" + s + "::" + t
}
protected def withCppNs(t: String) = withNs(Some(spec.cppNamespace), t)
}
......@@ -331,6 +331,8 @@ abstract class Generator(spec: Spec)
case Some(s) => "::" + s + "::" + t
}
def withCppNs(t: String) = withNs(Some(spec.cppNamespace), t)
def writeAlignedCall(w: IndentWriter, call: String, params: Seq[Field], delim: String, end: String, f: Field => String): IndentWriter = {
w.w(call)
val skipFirst = new SkipFirst
......
......@@ -8,4 +8,4 @@ objc:
cd objc; xcodebuild -sdk iphonesimulator -project DjinniObjcTest.xcodeproj -scheme DjinniObjcTest test
java:
cd java; ant test
cd java && ant test
......@@ -3,6 +3,8 @@
#include "assorted_primitives.hpp" // my header
namespace testsuite {
bool operator==(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs) {
return lhs.b == rhs.b &&
......@@ -24,3 +26,5 @@ bool operator==(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs) {
bool operator!=(const AssortedPrimitives& lhs, const AssortedPrimitives& rhs) {
return !(lhs == rhs);
}
} // namespace testsuite
......@@ -7,6 +7,8 @@
#include <experimental/optional>
#include <utility>
namespace testsuite {
struct AssortedPrimitives final {
bool b;
int8_t eight;
......@@ -56,3 +58,5 @@ struct AssortedPrimitives final {
, o_fsixtyfour(std::move(o_fsixtyfour))
{}
};
} // namespace testsuite
......@@ -9,6 +9,8 @@
#include <string>
#include <vector>
namespace testsuite {
/** Client interface */
class ClientInterface {
public:
......@@ -21,3 +23,5 @@ public:
virtual std::string return_str() = 0;
};
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <string>
#include <utility>
namespace testsuite {
/** Record returned by a client */
struct ClientReturnedRecord final {
int64_t record_id;
......@@ -22,3 +24,5 @@ struct ClientReturnedRecord final {
, misc(std::move(misc))
{}
};
} // namespace testsuite
......@@ -5,6 +5,8 @@
#include <functional>
namespace testsuite {
enum class color : int {
RED,
ORANGE,
......@@ -20,11 +22,13 @@ enum class color : int {
VIOLET,
};
} // namespace testsuite
namespace std {
template <>
struct hash<::color> {
size_t operator()(::color type) const {
struct hash<::testsuite::color> {
size_t operator()(::testsuite::color type) const {
return std::hash<int>()(static_cast<int>(type));
}
};
......
......@@ -3,6 +3,8 @@
#include "constants.hpp" // my header
namespace testsuite {
bool const Constants::BOOL_CONSTANT = true;
int8_t const Constants::I8_CONSTANT = 1;
......@@ -24,3 +26,5 @@ std::experimental::optional<int32_t> const Constants::OPTIONAL_INTEGER_CONSTANT
Constants const Constants::OBJECT_CONSTANT = Constants(
Constants::I32_CONSTANT /* some_integer */ ,
Constants::STRING_CONSTANT /* some_string */ );
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <string>
#include <utility>
namespace testsuite {
/** Record containing constants */
struct Constants final {
......@@ -45,3 +47,5 @@ struct Constants final {
, some_string(std::move(some_string))
{}
};
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "constants_interface.hpp" // my header
namespace testsuite {
bool const ConstantsInterface::BOOL_CONSTANT = true;
int8_t const ConstantsInterface::I8_CONSTANT = 1;
......@@ -16,3 +18,5 @@ int64_t const ConstantsInterface::I64_CONSTANT = 4;
float const ConstantsInterface::F32_CONSTANT = 5.0f;
double const ConstantsInterface::F64_CONSTANT = 5.0;
} // namespace testsuite
......@@ -5,6 +5,8 @@
#include <cstdint>
namespace testsuite {
/** Interface containing constants */
class ConstantsInterface {
public:
......@@ -32,3 +34,5 @@ public:
virtual void dummy() = 0;
};
} // namespace testsuite
......@@ -6,6 +6,8 @@
#include <cstdint>
#include <memory>
namespace testsuite {
class CppException {
public:
virtual ~CppException() {}
......@@ -14,3 +16,5 @@ public:
static std::shared_ptr<CppException> get();
};
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "date_record.hpp" // my header
namespace testsuite {
bool operator==(const DateRecord& lhs, const DateRecord& rhs) {
return lhs.created_at == rhs.created_at;
......@@ -33,3 +35,5 @@ bool operator<=(const DateRecord& lhs, const DateRecord& rhs) {
bool operator>=(const DateRecord& lhs, const DateRecord& rhs) {
return !(lhs < rhs);
}
} // namespace testsuite
......@@ -6,6 +6,8 @@
#include <chrono>
#include <utility>
namespace testsuite {
struct DateRecord final {
std::chrono::system_clock::time_point created_at;
......@@ -22,3 +24,5 @@ struct DateRecord final {
: created_at(std::move(created_at))
{}
};
} // namespace testsuite
......@@ -5,6 +5,8 @@
#include <utility>
namespace testsuite {
/**
* Empty record
* (Second line of multi-line documentation.
......@@ -12,3 +14,5 @@
*/
struct EmptyRecord final {
};
} // namespace testsuite
......@@ -11,5 +11,5 @@ class ExternInterface1 {
public:
virtual ~ExternInterface1() {}
virtual ::ClientReturnedRecord foo(const std::shared_ptr<::ClientInterface> & i) = 0;
virtual ::testsuite::ClientReturnedRecord foo(const std::shared_ptr<::testsuite::ClientInterface> & i) = 0;
};
......@@ -11,5 +11,5 @@ class ExternInterface2 {
public:
virtual ~ExternInterface2() {}
virtual ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & i) = 0;
virtual ExternRecordWithDerivings foo(const std::shared_ptr<::testsuite::TestHelpers> & i) = 0;
};
......@@ -9,8 +9,8 @@
/** This file tests YAML dumped by Djinni can be parsed back in */
struct ExternRecordWithDerivings final {
::RecordWithDerivings member;
::color e;
::testsuite::RecordWithDerivings member;
::testsuite::color e;
friend bool operator==(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator!=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
......@@ -21,8 +21,8 @@ struct ExternRecordWithDerivings final {
friend bool operator<=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator>=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
ExternRecordWithDerivings(::RecordWithDerivings member,
::color e)
ExternRecordWithDerivings(::testsuite::RecordWithDerivings member,
::testsuite::color e)
: member(std::move(member))
, e(std::move(e))
{}
......
......@@ -8,6 +8,8 @@
#include <unordered_map>
#include <utility>
namespace testsuite {
struct MapDateRecord final {
std::unordered_map<std::string, std::chrono::system_clock::time_point> dates_by_id;
......@@ -15,3 +17,5 @@ struct MapDateRecord final {
: dates_by_id(std::move(dates_by_id))
{}
};
} // namespace testsuite
......@@ -9,6 +9,8 @@
#include <utility>
#include <vector>
namespace testsuite {
struct MapListRecord final {
std::vector<std::unordered_map<std::string, int64_t>> map_list;
......@@ -16,3 +18,5 @@ struct MapListRecord final {
: map_list(std::move(map_list))
{}
};
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <unordered_map>
#include <utility>
namespace testsuite {
struct MapRecord final {
std::unordered_map<std::string, int64_t> map;
std::unordered_map<int32_t, int32_t> imap;
......@@ -18,3 +20,5 @@ struct MapRecord final {
, imap(std::move(imap))
{}
};
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <utility>
#include <vector>
namespace testsuite {
struct NestedCollection final {
std::vector<std::unordered_set<std::string>> set_list;
......@@ -15,3 +17,5 @@ struct NestedCollection final {
: set_list(std::move(set_list))
{}
};
} // namespace testsuite
......@@ -7,6 +7,8 @@
#include <utility>
#include <vector>
namespace testsuite {
struct PrimitiveList final {
std::vector<int64_t> list;
......@@ -14,3 +16,5 @@ struct PrimitiveList final {
: list(std::move(list))
{}
};
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "record_with_derivings.hpp" // my header
namespace testsuite {
bool operator==(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs) {
return lhs.key1 == rhs.key1 &&
......@@ -40,3 +42,5 @@ bool operator<=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs)
bool operator>=(const RecordWithDerivings& lhs, const RecordWithDerivings& rhs) {
return !(lhs < rhs);
}
} // namespace testsuite
......@@ -7,6 +7,8 @@
#include <string>
#include <utility>
namespace testsuite {
struct RecordWithDerivings final {
int32_t key1;
std::string key2;
......@@ -26,3 +28,5 @@ struct RecordWithDerivings final {
, key2(std::move(key2))
{}
};
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "record_with_duration_and_derivings.hpp" // my header
namespace testsuite {
bool operator==(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs) {
return lhs.dt == rhs.dt;
......@@ -33,3 +35,5 @@ bool operator<=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurat
bool operator>=(const RecordWithDurationAndDerivings& lhs, const RecordWithDurationAndDerivings& rhs) {
return !(lhs < rhs);
}
} // namespace testsuite
......@@ -6,6 +6,8 @@
#include <chrono>
#include <utility>
namespace testsuite {
struct RecordWithDurationAndDerivings final {
std::chrono::duration<double, std::nano> dt;
......@@ -22,3 +24,5 @@ struct RecordWithDurationAndDerivings final {
: dt(std::move(dt))
{}
};
} // namespace testsuite
......@@ -3,6 +3,8 @@
#include "record_with_nested_derivings.hpp" // my header
namespace testsuite {
bool operator==(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs) {
return lhs.key == rhs.key &&
......@@ -40,3 +42,5 @@ bool operator<=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDeri
bool operator>=(const RecordWithNestedDerivings& lhs, const RecordWithNestedDerivings& rhs) {
return !(lhs < rhs);
}
} // namespace testsuite
......@@ -7,6 +7,8 @@
#include <cstdint>
#include <utility>
namespace testsuite {
struct RecordWithNestedDerivings final {
int32_t key;
RecordWithDerivings rec;
......@@ -26,3 +28,5 @@ struct RecordWithNestedDerivings final {
, rec(std::move(rec))
{}
};
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <unordered_set>
#include <utility>
namespace testsuite {
struct SetRecord final {
std::unordered_set<std::string> set;
std::unordered_set<int32_t> iset;
......@@ -18,3 +20,5 @@ struct SetRecord final {
, iset(std::move(iset))
{}
};
} // namespace testsuite
......@@ -8,6 +8,8 @@
#include <experimental/optional>
#include <string>
namespace testsuite {
class TestDuration {
public:
virtual ~TestDuration() {}
......@@ -52,3 +54,5 @@ public:
static int64_t unbox(std::experimental::optional<std::chrono::duration<int64_t, std::ratio<1>>> dt);
};
} // namespace testsuite
......@@ -16,6 +16,8 @@
#include <unordered_map>
#include <vector>
namespace testsuite {
class ClientInterface;
class UserToken;
......@@ -83,3 +85,5 @@ public:
static std::vector<uint8_t> id_binary(const std::vector<uint8_t> & b);
};
} // namespace testsuite
......@@ -5,9 +5,13 @@
#include <string>
namespace testsuite {
class UserToken {
public:
virtual ~UserToken() {}
virtual std::string whoami() = 0;
};
} // namespace testsuite
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeAssortedPrimitives final {
public:
using CppType = ::AssortedPrimitives;
using CppType = ::testsuite::AssortedPrimitives;
using JniType = jobject;
using Boxed = NativeAssortedPrimitives;
......
......@@ -7,7 +7,7 @@
namespace djinni_generated {
NativeClientInterface::NativeClientInterface() : ::djinni::JniInterface<::ClientInterface, NativeClientInterface>() {}
NativeClientInterface::NativeClientInterface() : ::djinni::JniInterface<::testsuite::ClientInterface, NativeClientInterface>() {}
NativeClientInterface::~NativeClientInterface() = default;
......@@ -15,7 +15,7 @@ NativeClientInterface::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j)
NativeClientInterface::JavaProxy::~JavaProxy() = default;
::ClientReturnedRecord NativeClientInterface::JavaProxy::get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) {
::testsuite::ClientReturnedRecord NativeClientInterface::JavaProxy::get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativeClientInterface>::get();
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeClientInterface final : ::djinni::JniInterface<::ClientInterface, NativeClientInterface> {
class NativeClientInterface final : ::djinni::JniInterface<::testsuite::ClientInterface, NativeClientInterface> {
public:
using CppType = std::shared_ptr<::ClientInterface>;
using CppType = std::shared_ptr<::testsuite::ClientInterface>;
using JniType = jobject;
using Boxed = NativeClientInterface;
......@@ -23,21 +23,21 @@ public:
private:
NativeClientInterface();
friend ::djinni::JniClass<NativeClientInterface>;
friend ::djinni::JniInterface<::ClientInterface, NativeClientInterface>;
friend ::djinni::JniInterface<::testsuite::ClientInterface, NativeClientInterface>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::ClientInterface
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::testsuite::ClientInterface
{
public:
JavaProxy(JniType j);
~JavaProxy();
::ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) override;
::testsuite::ClientReturnedRecord get_record(int64_t record_id, const std::string & utf8string, const std::experimental::optional<std::string> & misc) override;
double identifier_check(const std::vector<uint8_t> & data, int32_t r, int64_t jret) override;
std::string return_str() override;
private:
using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend ::djinni::JniInterface<::ClientInterface, ::djinni_generated::NativeClientInterface>;
friend ::djinni::JniInterface<::testsuite::ClientInterface, ::djinni_generated::NativeClientInterface>;
friend ::djinni::JavaProxyCache<JavaProxy>;
};
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeClientReturnedRecord final {
public:
using CppType = ::ClientReturnedRecord;
using CppType = ::testsuite::ClientReturnedRecord;
using JniType = jobject;
using Boxed = NativeClientReturnedRecord;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeColor final : ::djinni::JniEnum {
public:
using CppType = ::color;
using CppType = ::testsuite::color;
using JniType = jobject;
using Boxed = NativeColor;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeConstants final {
public:
using CppType = ::Constants;
using CppType = ::testsuite::Constants;
using JniType = jobject;
using Boxed = NativeConstants;
......
......@@ -6,7 +6,7 @@
namespace djinni_generated {
NativeConstantsInterface::NativeConstantsInterface() : ::djinni::JniInterface<::ConstantsInterface, NativeConstantsInterface>("com/dropbox/djinni/test/ConstantsInterface$CppProxy") {}
NativeConstantsInterface::NativeConstantsInterface() : ::djinni::JniInterface<::testsuite::ConstantsInterface, NativeConstantsInterface>("com/dropbox/djinni/test/ConstantsInterface$CppProxy") {}
NativeConstantsInterface::~NativeConstantsInterface() = default;
......@@ -15,7 +15,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ConstantsInterface_00024Cpp
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::ConstantsInterface>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::ConstantsInterface>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -23,7 +23,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ConstantsInterface_00024Cpp
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::ConstantsInterface>::get(nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::testsuite::ConstantsInterface>::get(nativeRef);
ref->dummy();
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeConstantsInterface final : ::djinni::JniInterface<::ConstantsInterface, NativeConstantsInterface> {
class NativeConstantsInterface final : ::djinni::JniInterface<::testsuite::ConstantsInterface, NativeConstantsInterface> {
public:
using CppType = std::shared_ptr<::ConstantsInterface>;
using CppType = std::shared_ptr<::testsuite::ConstantsInterface>;
using JniType = jobject;
using Boxed = NativeConstantsInterface;
......@@ -23,7 +23,7 @@ public:
private:
NativeConstantsInterface();
friend ::djinni::JniClass<NativeConstantsInterface>;
friend ::djinni::JniInterface<::ConstantsInterface, NativeConstantsInterface>;
friend ::djinni::JniInterface<::testsuite::ConstantsInterface, NativeConstantsInterface>;
};
......
......@@ -7,7 +7,7 @@
namespace djinni_generated {
NativeCppException::NativeCppException() : ::djinni::JniInterface<::CppException, NativeCppException>("com/dropbox/djinni/test/CppException$CppProxy") {}
NativeCppException::NativeCppException() : ::djinni::JniInterface<::testsuite::CppException, NativeCppException>("com/dropbox/djinni/test/CppException$CppProxy") {}
NativeCppException::~NativeCppException() = default;
......@@ -16,7 +16,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::CppException>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::CppException>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -24,7 +24,7 @@ CJNIEXPORT jint JNICALL Java_com_dropbox_djinni_test_CppException_00024CppProxy_
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::CppException>::get(nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::testsuite::CppException>::get(nativeRef);
auto r = ref->throw_an_exception();
return ::djinni::release(::djinni::I32::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......@@ -34,7 +34,7 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_CppException_get(JNIEnv*
{
try {
DJINNI_FUNCTION_PROLOGUE0(jniEnv);
auto r = ::CppException::get();
auto r = ::testsuite::CppException::get();
return ::djinni::release(::djinni_generated::NativeCppException::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeCppException final : ::djinni::JniInterface<::CppException, NativeCppException> {
class NativeCppException final : ::djinni::JniInterface<::testsuite::CppException, NativeCppException> {
public:
using CppType = std::shared_ptr<::CppException>;
using CppType = std::shared_ptr<::testsuite::CppException>;
using JniType = jobject;
using Boxed = NativeCppException;
......@@ -23,7 +23,7 @@ public:
private:
NativeCppException();
friend ::djinni::JniClass<NativeCppException>;
friend ::djinni::JniInterface<::CppException, NativeCppException>;
friend ::djinni::JniInterface<::testsuite::CppException, NativeCppException>;
};
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeDateRecord final {
public:
using CppType = ::DateRecord;
using CppType = ::testsuite::DateRecord;
using JniType = jobject;
using Boxed = NativeDateRecord;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeEmptyRecord final {
public:
using CppType = ::EmptyRecord;
using CppType = ::testsuite::EmptyRecord;
using JniType = jobject;
using Boxed = NativeEmptyRecord;
......
......@@ -15,7 +15,7 @@ NativeExternInterface2::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j)
NativeExternInterface2::JavaProxy::~JavaProxy() = default;
::ExternRecordWithDerivings NativeExternInterface2::JavaProxy::foo(const std::shared_ptr<::TestHelpers> & c_i) {
::ExternRecordWithDerivings NativeExternInterface2::JavaProxy::foo(const std::shared_ptr<::testsuite::TestHelpers> & c_i) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativeExternInterface2>::get();
......
......@@ -31,7 +31,7 @@ private:
JavaProxy(JniType j);
~JavaProxy();
::ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & i) override;
::ExternRecordWithDerivings foo(const std::shared_ptr<::testsuite::TestHelpers> & i) override;
private:
using ::djinni::JavaProxyCacheEntry::getGlobalRef;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeMapDateRecord final {
public:
using CppType = ::MapDateRecord;
using CppType = ::testsuite::MapDateRecord;
using JniType = jobject;
using Boxed = NativeMapDateRecord;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeMapListRecord final {
public:
using CppType = ::MapListRecord;
using CppType = ::testsuite::MapListRecord;
using JniType = jobject;
using Boxed = NativeMapListRecord;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeMapRecord final {
public:
using CppType = ::MapRecord;
using CppType = ::testsuite::MapRecord;
using JniType = jobject;
using Boxed = NativeMapRecord;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeNestedCollection final {
public:
using CppType = ::NestedCollection;
using CppType = ::testsuite::NestedCollection;
using JniType = jobject;
using Boxed = NativeNestedCollection;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativePrimitiveList final {
public:
using CppType = ::PrimitiveList;
using CppType = ::testsuite::PrimitiveList;
using JniType = jobject;
using Boxed = NativePrimitiveList;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeRecordWithDerivings final {
public:
using CppType = ::RecordWithDerivings;
using CppType = ::testsuite::RecordWithDerivings;
using JniType = jobject;
using Boxed = NativeRecordWithDerivings;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeRecordWithDurationAndDerivings final {
public:
using CppType = ::RecordWithDurationAndDerivings;
using CppType = ::testsuite::RecordWithDurationAndDerivings;
using JniType = jobject;
using Boxed = NativeRecordWithDurationAndDerivings;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeRecordWithNestedDerivings final {
public:
using CppType = ::RecordWithNestedDerivings;
using CppType = ::testsuite::RecordWithNestedDerivings;
using JniType = jobject;
using Boxed = NativeRecordWithNestedDerivings;
......
......@@ -10,7 +10,7 @@ namespace djinni_generated {
class NativeSetRecord final {
public:
using CppType = ::SetRecord;
using CppType = ::testsuite::SetRecord;
using JniType = jobject;
using Boxed = NativeSetRecord;
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeTestDuration final : ::djinni::JniInterface<::TestDuration, NativeTestDuration> {
class NativeTestDuration final : ::djinni::JniInterface<::testsuite::TestDuration, NativeTestDuration> {
public:
using CppType = std::shared_ptr<::TestDuration>;
using CppType = std::shared_ptr<::testsuite::TestDuration>;
using JniType = jobject;
using Boxed = NativeTestDuration;
......@@ -23,7 +23,7 @@ public:
private:
NativeTestDuration();
friend ::djinni::JniClass<NativeTestDuration>;
friend ::djinni::JniInterface<::TestDuration, NativeTestDuration>;
friend ::djinni::JniInterface<::testsuite::TestDuration, NativeTestDuration>;
};
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeTestHelpers final : ::djinni::JniInterface<::TestHelpers, NativeTestHelpers> {
class NativeTestHelpers final : ::djinni::JniInterface<::testsuite::TestHelpers, NativeTestHelpers> {
public:
using CppType = std::shared_ptr<::TestHelpers>;
using CppType = std::shared_ptr<::testsuite::TestHelpers>;
using JniType = jobject;
using Boxed = NativeTestHelpers;
......@@ -23,7 +23,7 @@ public:
private:
NativeTestHelpers();
friend ::djinni::JniClass<NativeTestHelpers>;
friend ::djinni::JniInterface<::TestHelpers, NativeTestHelpers>;
friend ::djinni::JniInterface<::testsuite::TestHelpers, NativeTestHelpers>;
};
......
......@@ -6,7 +6,7 @@
namespace djinni_generated {
NativeUserToken::NativeUserToken() : ::djinni::JniInterface<::UserToken, NativeUserToken>("com/dropbox/djinni/test/UserToken$CppProxy") {}
NativeUserToken::NativeUserToken() : ::djinni::JniInterface<::testsuite::UserToken, NativeUserToken>("com/dropbox/djinni/test/UserToken$CppProxy") {}
NativeUserToken::~NativeUserToken() = default;
......@@ -27,7 +27,7 @@ CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_UserToken_00024CppProxy_nat
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::UserToken>*>(nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::testsuite::UserToken>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
......@@ -35,7 +35,7 @@ CJNIEXPORT jstring JNICALL Java_com_dropbox_djinni_test_UserToken_00024CppProxy_
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::UserToken>::get(nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::testsuite::UserToken>::get(nativeRef);
auto r = ref->whoami();
return ::djinni::release(::djinni::String::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
......
......@@ -8,9 +8,9 @@
namespace djinni_generated {
class NativeUserToken final : ::djinni::JniInterface<::UserToken, NativeUserToken> {
class NativeUserToken final : ::djinni::JniInterface<::testsuite::UserToken, NativeUserToken> {
public:
using CppType = std::shared_ptr<::UserToken>;
using CppType = std::shared_ptr<::testsuite::UserToken>;
using JniType = jobject;
using Boxed = NativeUserToken;
......@@ -23,9 +23,9 @@ public:
private:
NativeUserToken();
friend ::djinni::JniClass<NativeUserToken>;
friend ::djinni::JniInterface<::UserToken, NativeUserToken>;
friend ::djinni::JniInterface<::testsuite::UserToken, NativeUserToken>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::UserToken
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::testsuite::UserToken
{
public:
JavaProxy(JniType j);
......@@ -35,7 +35,7 @@ private:
private:
using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend ::djinni::JniInterface<::UserToken, ::djinni_generated::NativeUserToken>;
friend ::djinni::JniInterface<::testsuite::UserToken, ::djinni_generated::NativeUserToken>;
friend ::djinni::JavaProxyCache<JavaProxy>;
};
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct AssortedPrimitives
{
using CppType = ::AssortedPrimitives;
using CppType = ::testsuite::AssortedPrimitives;
using ObjcType = DBAssortedPrimitives*;
using Boxed = AssortedPrimitives;
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class ClientInterface
{
public:
using CppType = std::shared_ptr<::ClientInterface>;
using CppType = std::shared_ptr<::testsuite::ClientInterface>;
using ObjcType = id<DBClientInterface>;
using Boxed = ClientInterface;
......
......@@ -12,12 +12,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
namespace djinni_generated {
class ClientInterface::ObjcProxy final
: public ::ClientInterface
: public ::testsuite::ClientInterface
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
using Handle::Handle;
::ClientReturnedRecord get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) override
::testsuite::ClientReturnedRecord get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) override
{
@autoreleasepool {
auto r = [(ObjcType)Handle::get() getRecord:(::djinni::I64::fromCpp(c_record_id))
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct ClientReturnedRecord
{
using CppType = ::ClientReturnedRecord;
using CppType = ::testsuite::ClientReturnedRecord;
using ObjcType = DBClientReturnedRecord*;
using Boxed = ClientReturnedRecord;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct Constants
{
using CppType = ::Constants;
using CppType = ::testsuite::Constants;
using ObjcType = DBConstants*;
using Boxed = Constants;
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class ConstantsInterface
{
public:
using CppType = std::shared_ptr<::ConstantsInterface>;
using CppType = std::shared_ptr<::testsuite::ConstantsInterface>;
using ObjcType = DBConstantsInterface*;
using Boxed = ConstantsInterface;
......
......@@ -13,15 +13,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBConstantsInterface ()
- (id)initWithCpp:(const std::shared_ptr<::ConstantsInterface>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantsInterface>&)cppRef;
@end
@implementation DBConstantsInterface {
::djinni::DbxCppWrapperCache<::ConstantsInterface>::Handle _cppRefHandle;
::djinni::DbxCppWrapperCache<::testsuite::ConstantsInterface>::Handle _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::ConstantsInterface>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::testsuite::ConstantsInterface>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
......@@ -50,7 +50,7 @@ auto ConstantsInterface::fromCpp(const CppType& cpp) -> ObjcType
if (!cpp) {
return nil;
}
return ::djinni::DbxCppWrapperCache<::ConstantsInterface>::getInstance()->get(cpp, [] (const CppType& p) {
return ::djinni::DbxCppWrapperCache<::testsuite::ConstantsInterface>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBConstantsInterface alloc] initWithCpp:p];
});
}
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class CppException
{
public:
using CppType = std::shared_ptr<::CppException>;
using CppType = std::shared_ptr<::testsuite::CppException>;
using ObjcType = DBCppException*;
using Boxed = CppException;
......
......@@ -14,15 +14,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBCppException ()
- (id)initWithCpp:(const std::shared_ptr<::CppException>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::testsuite::CppException>&)cppRef;
@end
@implementation DBCppException {
::djinni::DbxCppWrapperCache<::CppException>::Handle _cppRefHandle;
::djinni::DbxCppWrapperCache<::testsuite::CppException>::Handle _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::CppException>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::testsuite::CppException>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
......@@ -39,7 +39,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
+ (nullable DBCppException *)get {
try {
auto r = ::CppException::get();
auto r = ::testsuite::CppException::get();
return ::djinni_generated::CppException::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......@@ -59,7 +59,7 @@ auto CppException::fromCpp(const CppType& cpp) -> ObjcType
if (!cpp) {
return nil;
}
return ::djinni::DbxCppWrapperCache<::CppException>::getInstance()->get(cpp, [] (const CppType& p) {
return ::djinni::DbxCppWrapperCache<::testsuite::CppException>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBCppException alloc] initWithCpp:p];
});
}
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct DateRecord
{
using CppType = ::DateRecord;
using CppType = ::testsuite::DateRecord;
using ObjcType = DBDateRecord*;
using Boxed = DateRecord;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct EmptyRecord
{
using CppType = ::EmptyRecord;
using CppType = ::testsuite::EmptyRecord;
using ObjcType = DBEmptyRecord*;
using Boxed = EmptyRecord;
......
......@@ -17,7 +17,7 @@ class ExternInterface2::ObjcProxy final
{
public:
using Handle::Handle;
::ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & c_i) override
::ExternRecordWithDerivings foo(const std::shared_ptr<::testsuite::TestHelpers> & c_i) override
{
@autoreleasepool {
auto r = [(ObjcType)Handle::get() foo:(::djinni_generated::TestHelpers::fromCpp(c_i))];
......
......@@ -12,13 +12,13 @@ auto ExternRecordWithDerivings::toCpp(ObjcType obj) -> CppType
{
assert(obj);
return {::djinni_generated::RecordWithDerivings::toCpp(obj.member),
::djinni::Enum<::color, DBColor>::toCpp(obj.e)};
::djinni::Enum<::testsuite::color, DBColor>::toCpp(obj.e)};
}
auto ExternRecordWithDerivings::fromCpp(const CppType& cpp) -> ObjcType
{
return [[DBExternRecordWithDerivings alloc] initWithMember:(::djinni_generated::RecordWithDerivings::fromCpp(cpp.member))
e:(::djinni::Enum<::color, DBColor>::fromCpp(cpp.e))];
e:(::djinni::Enum<::testsuite::color, DBColor>::fromCpp(cpp.e))];
}
} // namespace djinni_generated
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct MapDateRecord
{
using CppType = ::MapDateRecord;
using CppType = ::testsuite::MapDateRecord;
using ObjcType = DBMapDateRecord*;
using Boxed = MapDateRecord;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct MapListRecord
{
using CppType = ::MapListRecord;
using CppType = ::testsuite::MapListRecord;
using ObjcType = DBMapListRecord*;
using Boxed = MapListRecord;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct MapRecord
{
using CppType = ::MapRecord;
using CppType = ::testsuite::MapRecord;
using ObjcType = DBMapRecord*;
using Boxed = MapRecord;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct NestedCollection
{
using CppType = ::NestedCollection;
using CppType = ::testsuite::NestedCollection;
using ObjcType = DBNestedCollection*;
using Boxed = NestedCollection;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct PrimitiveList
{
using CppType = ::PrimitiveList;
using CppType = ::testsuite::PrimitiveList;
using ObjcType = DBPrimitiveList*;
using Boxed = PrimitiveList;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct RecordWithDerivings
{
using CppType = ::RecordWithDerivings;
using CppType = ::testsuite::RecordWithDerivings;
using ObjcType = DBRecordWithDerivings*;
using Boxed = RecordWithDerivings;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct RecordWithDurationAndDerivings
{
using CppType = ::RecordWithDurationAndDerivings;
using CppType = ::testsuite::RecordWithDurationAndDerivings;
using ObjcType = DBRecordWithDurationAndDerivings*;
using Boxed = RecordWithDurationAndDerivings;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct RecordWithNestedDerivings
{
using CppType = ::RecordWithNestedDerivings;
using CppType = ::testsuite::RecordWithNestedDerivings;
using ObjcType = DBRecordWithNestedDerivings*;
using Boxed = RecordWithNestedDerivings;
......
......@@ -12,7 +12,7 @@ namespace djinni_generated {
struct SetRecord
{
using CppType = ::SetRecord;
using CppType = ::testsuite::SetRecord;
using ObjcType = DBSetRecord*;
using Boxed = SetRecord;
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class TestDuration
{
public:
using CppType = std::shared_ptr<::TestDuration>;
using CppType = std::shared_ptr<::testsuite::TestDuration>;
using ObjcType = DBTestDuration*;
using Boxed = TestDuration;
......
......@@ -14,15 +14,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBTestDuration ()
- (id)initWithCpp:(const std::shared_ptr<::TestDuration>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::testsuite::TestDuration>&)cppRef;
@end
@implementation DBTestDuration {
::djinni::DbxCppWrapperCache<::TestDuration>::Handle _cppRefHandle;
::djinni::DbxCppWrapperCache<::testsuite::TestDuration>::Handle _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::TestDuration>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::testsuite::TestDuration>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
......@@ -32,140 +32,140 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
+ (nonnull NSString *)hoursString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::hoursString(::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::toCpp(dt));
auto r = ::testsuite::TestDuration::hoursString(::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSString *)minutesString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::minutesString(::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::toCpp(dt));
auto r = ::testsuite::TestDuration::minutesString(::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSString *)secondsString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::secondsString(::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::toCpp(dt));
auto r = ::testsuite::TestDuration::secondsString(::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSString *)millisString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::millisString(::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::toCpp(dt));
auto r = ::testsuite::TestDuration::millisString(::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSString *)microsString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::microsString(::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::toCpp(dt));
auto r = ::testsuite::TestDuration::microsString(::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSString *)nanosString:(NSTimeInterval)dt {
try {
auto r = ::TestDuration::nanosString(::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::toCpp(dt));
auto r = ::testsuite::TestDuration::nanosString(::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::toCpp(dt));
return ::djinni::String::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)hours:(int32_t)count {
try {
auto r = ::TestDuration::hours(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::hours(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_h>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)minutes:(int32_t)count {
try {
auto r = ::TestDuration::minutes(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::minutes(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_min>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)seconds:(int32_t)count {
try {
auto r = ::TestDuration::seconds(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::seconds(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_s>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)millis:(int32_t)count {
try {
auto r = ::TestDuration::millis(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::millis(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_ms>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)micros:(int32_t)count {
try {
auto r = ::TestDuration::micros(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::micros(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_us>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)nanos:(int32_t)count {
try {
auto r = ::TestDuration::nanos(::djinni::I32::toCpp(count));
auto r = ::testsuite::TestDuration::nanos(::djinni::I32::toCpp(count));
return ::djinni::Duration<::djinni::I32, ::djinni::Duration_ns>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)hoursf:(double)count {
try {
auto r = ::TestDuration::hoursf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::hoursf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_h>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)minutesf:(double)count {
try {
auto r = ::TestDuration::minutesf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::minutesf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_min>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)secondsf:(double)count {
try {
auto r = ::TestDuration::secondsf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::secondsf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_s>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)millisf:(double)count {
try {
auto r = ::TestDuration::millisf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::millisf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_ms>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)microsf:(double)count {
try {
auto r = ::TestDuration::microsf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::microsf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_us>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSTimeInterval)nanosf:(double)count {
try {
auto r = ::TestDuration::nanosf(::djinni::F64::toCpp(count));
auto r = ::testsuite::TestDuration::nanosf(::djinni::F64::toCpp(count));
return ::djinni::Duration<::djinni::F64, ::djinni::Duration_ns>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nullable NSNumber *)box:(int64_t)count {
try {
auto r = ::TestDuration::box(::djinni::I64::toCpp(count));
auto r = ::testsuite::TestDuration::box(::djinni::I64::toCpp(count));
return ::djinni::Optional<std::experimental::optional, ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (int64_t)unbox:(nullable NSNumber *)dt {
try {
auto r = ::TestDuration::unbox(::djinni::Optional<std::experimental::optional, ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>>::toCpp(dt));
auto r = ::testsuite::TestDuration::unbox(::djinni::Optional<std::experimental::optional, ::djinni::Duration<::djinni::I64, ::djinni::Duration_s>>::toCpp(dt));
return ::djinni::I64::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......@@ -185,7 +185,7 @@ auto TestDuration::fromCpp(const CppType& cpp) -> ObjcType
if (!cpp) {
return nil;
}
return ::djinni::DbxCppWrapperCache<::TestDuration>::getInstance()->get(cpp, [] (const CppType& p) {
return ::djinni::DbxCppWrapperCache<::testsuite::TestDuration>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBTestDuration alloc] initWithCpp:p];
});
}
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class TestHelpers
{
public:
using CppType = std::shared_ptr<::TestHelpers>;
using CppType = std::shared_ptr<::testsuite::TestHelpers>;
using ObjcType = DBTestHelpers*;
using Boxed = TestHelpers;
......
......@@ -20,15 +20,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBTestHelpers ()
- (id)initWithCpp:(const std::shared_ptr<::TestHelpers>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::testsuite::TestHelpers>&)cppRef;
@end
@implementation DBTestHelpers {
::djinni::DbxCppWrapperCache<::TestHelpers>::Handle _cppRefHandle;
::djinni::DbxCppWrapperCache<::testsuite::TestHelpers>::Handle _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::TestHelpers>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::testsuite::TestHelpers>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
......@@ -38,135 +38,135 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
+ (nonnull DBSetRecord *)getSetRecord {
try {
auto r = ::TestHelpers::get_set_record();
auto r = ::testsuite::TestHelpers::get_set_record();
return ::djinni_generated::SetRecord::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkSetRecord:(nonnull DBSetRecord *)rec {
try {
auto r = ::TestHelpers::check_set_record(::djinni_generated::SetRecord::toCpp(rec));
auto r = ::testsuite::TestHelpers::check_set_record(::djinni_generated::SetRecord::toCpp(rec));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull DBPrimitiveList *)getPrimitiveList {
try {
auto r = ::TestHelpers::get_primitive_list();
auto r = ::testsuite::TestHelpers::get_primitive_list();
return ::djinni_generated::PrimitiveList::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkPrimitiveList:(nonnull DBPrimitiveList *)pl {
try {
auto r = ::TestHelpers::check_primitive_list(::djinni_generated::PrimitiveList::toCpp(pl));
auto r = ::testsuite::TestHelpers::check_primitive_list(::djinni_generated::PrimitiveList::toCpp(pl));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull DBNestedCollection *)getNestedCollection {
try {
auto r = ::TestHelpers::get_nested_collection();
auto r = ::testsuite::TestHelpers::get_nested_collection();
return ::djinni_generated::NestedCollection::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkNestedCollection:(nonnull DBNestedCollection *)nc {
try {
auto r = ::TestHelpers::check_nested_collection(::djinni_generated::NestedCollection::toCpp(nc));
auto r = ::testsuite::TestHelpers::check_nested_collection(::djinni_generated::NestedCollection::toCpp(nc));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSDictionary *)getMap {
try {
auto r = ::TestHelpers::get_map();
auto r = ::testsuite::TestHelpers::get_map();
return ::djinni::Map<::djinni::String, ::djinni::I64>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkMap:(nonnull NSDictionary *)m {
try {
auto r = ::TestHelpers::check_map(::djinni::Map<::djinni::String, ::djinni::I64>::toCpp(m));
auto r = ::testsuite::TestHelpers::check_map(::djinni::Map<::djinni::String, ::djinni::I64>::toCpp(m));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSDictionary *)getEmptyMap {
try {
auto r = ::TestHelpers::get_empty_map();
auto r = ::testsuite::TestHelpers::get_empty_map();
return ::djinni::Map<::djinni::String, ::djinni::I64>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkEmptyMap:(nonnull NSDictionary *)m {
try {
auto r = ::TestHelpers::check_empty_map(::djinni::Map<::djinni::String, ::djinni::I64>::toCpp(m));
auto r = ::testsuite::TestHelpers::check_empty_map(::djinni::Map<::djinni::String, ::djinni::I64>::toCpp(m));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull DBMapListRecord *)getMapListRecord {
try {
auto r = ::TestHelpers::get_map_list_record();
auto r = ::testsuite::TestHelpers::get_map_list_record();
return ::djinni_generated::MapListRecord::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkMapListRecord:(nonnull DBMapListRecord *)m {
try {
auto r = ::TestHelpers::check_map_list_record(::djinni_generated::MapListRecord::toCpp(m));
auto r = ::testsuite::TestHelpers::check_map_list_record(::djinni_generated::MapListRecord::toCpp(m));
return ::djinni::Bool::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkClientInterfaceAscii:(nullable id<DBClientInterface>)i {
try {
::TestHelpers::check_client_interface_ascii(::djinni_generated::ClientInterface::toCpp(i));
::testsuite::TestHelpers::check_client_interface_ascii(::djinni_generated::ClientInterface::toCpp(i));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkClientInterfaceNonascii:(nullable id<DBClientInterface>)i {
try {
::TestHelpers::check_client_interface_nonascii(::djinni_generated::ClientInterface::toCpp(i));
::testsuite::TestHelpers::check_client_interface_nonascii(::djinni_generated::ClientInterface::toCpp(i));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkEnumMap:(nonnull NSDictionary *)m {
try {
::TestHelpers::check_enum_map(::djinni::Map<::djinni::Enum<::color, DBColor>, ::djinni::String>::toCpp(m));
::testsuite::TestHelpers::check_enum_map(::djinni::Map<::djinni::Enum<::testsuite::color, DBColor>, ::djinni::String>::toCpp(m));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkEnum:(DBColor)c {
try {
::TestHelpers::check_enum(::djinni::Enum<::color, DBColor>::toCpp(c));
::testsuite::TestHelpers::check_enum(::djinni::Enum<::testsuite::color, DBColor>::toCpp(c));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nullable id<DBUserToken>)tokenId:(nullable id<DBUserToken>)t {
try {
auto r = ::TestHelpers::token_id(::djinni_generated::UserToken::toCpp(t));
auto r = ::testsuite::TestHelpers::token_id(::djinni_generated::UserToken::toCpp(t));
return ::djinni_generated::UserToken::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nullable id<DBUserToken>)createCppToken {
try {
auto r = ::TestHelpers::create_cpp_token();
auto r = ::testsuite::TestHelpers::create_cpp_token();
return ::djinni_generated::UserToken::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkCppToken:(nullable id<DBUserToken>)t {
try {
::TestHelpers::check_cpp_token(::djinni_generated::UserToken::toCpp(t));
::testsuite::TestHelpers::check_cpp_token(::djinni_generated::UserToken::toCpp(t));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (int64_t)cppTokenId:(nullable id<DBUserToken>)t {
try {
auto r = ::TestHelpers::cpp_token_id(::djinni_generated::UserToken::toCpp(t));
auto r = ::testsuite::TestHelpers::cpp_token_id(::djinni_generated::UserToken::toCpp(t));
return ::djinni::I64::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......@@ -174,28 +174,28 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
+ (void)checkTokenType:(nullable id<DBUserToken>)t
type:(nonnull NSString *)type {
try {
::TestHelpers::check_token_type(::djinni_generated::UserToken::toCpp(t),
::djinni::String::toCpp(type));
::testsuite::TestHelpers::check_token_type(::djinni_generated::UserToken::toCpp(t),
::djinni::String::toCpp(type));
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nullable NSNumber *)returnNone {
try {
auto r = ::TestHelpers::return_none();
auto r = ::testsuite::TestHelpers::return_none();
return ::djinni::Optional<std::experimental::optional, ::djinni::I32>::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull DBAssortedPrimitives *)assortedPrimitivesId:(nonnull DBAssortedPrimitives *)i {
try {
auto r = ::TestHelpers::assorted_primitives_id(::djinni_generated::AssortedPrimitives::toCpp(i));
auto r = ::testsuite::TestHelpers::assorted_primitives_id(::djinni_generated::AssortedPrimitives::toCpp(i));
return ::djinni_generated::AssortedPrimitives::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (nonnull NSData *)idBinary:(nonnull NSData *)b {
try {
auto r = ::TestHelpers::id_binary(::djinni::Binary::toCpp(b));
auto r = ::testsuite::TestHelpers::id_binary(::djinni::Binary::toCpp(b));
return ::djinni::Binary::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
......@@ -215,7 +215,7 @@ auto TestHelpers::fromCpp(const CppType& cpp) -> ObjcType
if (!cpp) {
return nil;
}
return ::djinni::DbxCppWrapperCache<::TestHelpers>::getInstance()->get(cpp, [] (const CppType& p) {
return ::djinni::DbxCppWrapperCache<::testsuite::TestHelpers>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBTestHelpers alloc] initWithCpp:p];
});
}
......
......@@ -13,7 +13,7 @@ namespace djinni_generated {
class UserToken
{
public:
using CppType = std::shared_ptr<::UserToken>;
using CppType = std::shared_ptr<::testsuite::UserToken>;
using ObjcType = id<DBUserToken>;
using Boxed = UserToken;
......
......@@ -14,15 +14,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
@interface DBUserTokenCppProxy : NSObject<DBUserToken>
- (id)initWithCpp:(const std::shared_ptr<::UserToken>&)cppRef;
- (id)initWithCpp:(const std::shared_ptr<::testsuite::UserToken>&)cppRef;
@end
@implementation DBUserTokenCppProxy {
::djinni::DbxCppWrapperCache<::UserToken>::Handle _cppRefHandle;
::djinni::DbxCppWrapperCache<::testsuite::UserToken>::Handle _cppRefHandle;
}
- (id)initWithCpp:(const std::shared_ptr<::UserToken>&)cppRef
- (id)initWithCpp:(const std::shared_ptr<::testsuite::UserToken>&)cppRef
{
if (self = [super init]) {
_cppRefHandle.assign(cppRef);
......@@ -40,7 +40,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
namespace djinni_generated {
class UserToken::ObjcProxy final
: public ::UserToken
: public ::testsuite::UserToken
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
......@@ -77,7 +77,7 @@ auto UserToken::fromCpp(const CppType& cpp) -> ObjcType
if (auto cppPtr = dynamic_cast<ObjcProxy*>(cpp.get())) {
return cppPtr->Handle::get();
}
return ::djinni::DbxCppWrapperCache<::UserToken>::getInstance()->get(cpp, [] (const CppType& p) {
return ::djinni::DbxCppWrapperCache<::testsuite::UserToken>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBUserTokenCppProxy alloc] initWithCpp:p];
});
}
......
#include "test_duration.hpp"
namespace testsuite {
std::string TestDuration::hoursString(std::chrono::duration<int32_t, std::ratio<3600>> dt)
{
return std::to_string(dt.count());
......@@ -101,3 +103,5 @@ int64_t TestDuration::unbox(std::experimental::optional<std::chrono::duration<in
{
return dt ? dt->count() : -1;
}
} // namespace testsuite
#include "cpp_exception_impl.hpp"
#include <exception>
namespace testsuite {
int32_t CppExceptionImpl::throw_an_exception() {
throw ExampleException();
}
......@@ -8,3 +10,5 @@ int32_t CppExceptionImpl::throw_an_exception() {
std::shared_ptr<CppException> CppException::get() {
return std::make_shared<CppExceptionImpl>();
}
} // namespace testsuite
#include "cpp_exception.hpp"
#include <exception>
namespace testsuite {
class ExampleException: public std::exception {
virtual const char* what() const throw() {
return "Exception Thrown";
......@@ -16,3 +18,6 @@ class CppExceptionImpl : public CppException {
virtual int32_t throw_an_exception () override;
};
} // namespace testsuite
......@@ -4,6 +4,8 @@
#include "user_token.hpp"
#include <exception>
namespace testsuite {
SetRecord TestHelpers::get_set_record() {
return SetRecord { {
"StringA",
......@@ -142,3 +144,5 @@ AssortedPrimitives TestHelpers::assorted_primitives_id(const AssortedPrimitives
std::vector<uint8_t> TestHelpers::id_binary(const std::vector<uint8_t> & v) {
return v;
}
} // namespace testsuite
......@@ -3,6 +3,8 @@
#import "DBTestHelpers.h"
#import <XCTest/XCTest.h>
using namespace testsuite;
@interface DBClientInterfaceTests : XCTestCase
@end
......
......@@ -4,6 +4,8 @@
#include "cpp_exception_impl.hpp"
using namespace testsuite;
@interface DBCppExceptionTests : XCTestCase
@end
......
......@@ -4,6 +4,8 @@
#include "date_record.hpp"
#import <XCTest/XCTest.h>
using namespace testsuite;
@interface DBDateRecordTests : XCTestCase
@end
......
......@@ -6,6 +6,8 @@
#include "map_record.hpp"
using namespace testsuite;
@interface DBMapRecordTests : XCTestCase
@end
......
......@@ -3,6 +3,8 @@
#include "nested_collection.hpp"
using namespace testsuite;
static NestedCollection cppNestedCollection { { {u8"String1", u8"String2"}, {u8"StringA", u8"StringB"} } };
static DBNestedCollection *objcNestedCollection = [DBNestedCollection nestedCollectionWithSetList:@[
[NSSet setWithArray:@[ @"String1", @"String2" ]],
......
This diff is collapsed.
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