diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 206178b..4422c0d 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -41,7 +41,7 @@ jobs: if: ${{ matrix.rust.clippy }} run: cargo clippy --all-targets -- -D warnings - name: Test - run: cargo test + run: CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test fmt: name: Rust fmt diff --git a/Cargo.toml b/Cargo.toml index 43be68c..2f8117c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "bdk-ffi" version = "0.10.0" authors = ["Steve Myers ", "Sudarsan Balaji "] edition = "2018" +license = "MIT OR Apache-2.0" [workspace] members = [".","bdk-ffi-bindgen"] diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..9d7c154 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,21 @@ +# Integration tests for bdk-ffi + +This contains simple tests to make sure bdk-ffi can be used as a dependency for each of the +supported bindings languages. + +To skip integration tests and only run unit tests use `cargo test --lib`. + +To run all tests including integration tests use `CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test`. + +Before running integration tests you must install the following development tools: + +1. [Java](https://openjdk.org/) and [Kotlin](https://kotlinlang.org/), +[sdkman](https://sdkman.io/) can help: + ```shell + sdk install java 11.0.16.1-zulu + sdk install kotlin 1.7.20` + ``` + +2. [Swift](https://www.swift.org/) + +3. [Python](https://www.python.org/) diff --git a/tests/bindings/test.kts b/tests/bindings/test.kts new file mode 100644 index 0000000..3ccac8f --- /dev/null +++ b/tests/bindings/test.kts @@ -0,0 +1,8 @@ +/* + * This is a basic test kotlin program that does nothing but confirm that the kotlin bindings compile + * and that a program that depends on them will run. + */ + +import org.bitcoindevkit.* + +val network = Network.TESTNET diff --git a/tests/bindings/test.py b/tests/bindings/test.py new file mode 100644 index 0000000..5b0c157 --- /dev/null +++ b/tests/bindings/test.py @@ -0,0 +1,15 @@ +import unittest +from bdk import * + +class TestBdk(unittest.TestCase): + + def test_some_enum(self): + network = Network.TESTNET + + def test_some_dict(self): + a = AddressInfo(index=42, address="testaddress") + self.assertEqual(42, a.index) + self.assertEqual("testaddress", a.address) + +if __name__=='__main__': + unittest.main() diff --git a/tests/bindings/test.swift b/tests/bindings/test.swift new file mode 100644 index 0000000..04afd6a --- /dev/null +++ b/tests/bindings/test.swift @@ -0,0 +1,9 @@ +/* + * This is a basic test swift program that does nothing but confirm that the swift bindings compile + * and that a program that depends on them will run. + */ + +import Foundation +import bdk + +let network = Network.testnet diff --git a/tests/jna/jna-5.8.0.jar b/tests/jna/jna-5.8.0.jar new file mode 100644 index 0000000..c3d534c Binary files /dev/null and b/tests/jna/jna-5.8.0.jar differ diff --git a/tests/test_generated_bindings.rs b/tests/test_generated_bindings.rs new file mode 100644 index 0000000..943c277 --- /dev/null +++ b/tests/test_generated_bindings.rs @@ -0,0 +1,8 @@ +uniffi_macros::build_foreign_language_testcases!( + ["src/bdk.udl",], + [ + "tests/bindings/test.kts", + "tests/bindings/test.swift", + "tests/bindings/test.py" + ] +);