Skip to content

Commit

Permalink
add another test function
Browse files Browse the repository at this point in the history
  • Loading branch information
mfarrugi committed Dec 11, 2018
1 parent aeea72f commit a4f944a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/ffi/python_calling_rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
pub extern fn my_favorite_number() -> i32 {
4
}

#[no_mangle]
pub extern fn triple_it(x: i32) -> i32 {
x * 3
}
2 changes: 2 additions & 0 deletions examples/ffi/python_calling_rust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class TestFFI(unittest.TestCase):
def test_number(self):
self.assertEquals(rusty.my_favorite_number(), 4)

def test_tripler(self):
self.assertEquals(rusty.triple_it(5), 15)

if __name__ == "__main__":
unittest.main()

0 comments on commit a4f944a

Please sign in to comment.