Merge bitcoindevkit/bdk-ffi#215: Add simple kotlin, swift and python integration tests
ee6ee8139afd74c858216ed99ffdec92dc101787 Add simple kotlin,swift, and python integration tests (Steve Myers) Pull request description: ### Description Add simple kotlin, swift and python integration tests. These tests confirm fixes in #216 and #214. ### Notes to the reviewers To skip integration tests use: `cargo test --lib`. Otherwise java, kotlin, swift, and python need to be installed, and you must run tests with: `CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test` ### Changelog notice - Integration tests added, see tests/README.md for updated instructions for running tests. #215 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [x] I've added tests for the new feature * [x] I've added docs for the new feature #### Bugfixes: * [x] I've added tests to reproduce the issue which are now passing ACKs for top commit: thunderbiscuit: ACK [ee6ee81](ee6ee8139a
). waterst0ne: > ACK [ee6ee81](ee6ee8139a
). Tree-SHA512: 06ab14da1185de431c16b767f187bc8e7792106df54314242b26f225e3a8ddada28317b7cb8bec47b8b248d3088d0305ab777770525540c72d2815349a73728b
This commit is contained in:
commit
036e790a75
2
.github/workflows/cont_integration.yml
vendored
2
.github/workflows/cont_integration.yml
vendored
@ -41,7 +41,7 @@ jobs:
|
|||||||
if: ${{ matrix.rust.clippy }}
|
if: ${{ matrix.rust.clippy }}
|
||||||
run: cargo clippy --all-targets -- -D warnings
|
run: cargo clippy --all-targets -- -D warnings
|
||||||
- name: Test
|
- name: Test
|
||||||
run: cargo test
|
run: CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rust fmt
|
name: Rust fmt
|
||||||
|
@ -3,6 +3,7 @@ name = "bdk-ffi"
|
|||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"]
|
authors = ["Steve Myers <steve@notmandatory.org>", "Sudarsan Balaji <sudarsan.balaji@artfuldev.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [".","bdk-ffi-bindgen"]
|
members = [".","bdk-ffi-bindgen"]
|
||||||
|
21
tests/README.md
Normal file
21
tests/README.md
Normal file
@ -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/)
|
8
tests/bindings/test.kts
Normal file
8
tests/bindings/test.kts
Normal file
@ -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
|
15
tests/bindings/test.py
Normal file
15
tests/bindings/test.py
Normal file
@ -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()
|
9
tests/bindings/test.swift
Normal file
9
tests/bindings/test.swift
Normal file
@ -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
|
BIN
tests/jna/jna-5.8.0.jar
Normal file
BIN
tests/jna/jna-5.8.0.jar
Normal file
Binary file not shown.
8
tests/test_generated_bindings.rs
Normal file
8
tests/test_generated_bindings.rs
Normal file
@ -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"
|
||||||
|
]
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user