diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-23 17:03:29 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-23 17:52:15 +0100 |
commit | 0e141bfe68681ffeb7c825d00a854155402bc01d (patch) | |
tree | 404b519fddc7bfeb2b7ac43900f1530816d6a48a | |
parent | b709e25b133d397fc0e6b591f566945257150374 (diff) |
openpgp-ffi: Add test.
-rw-r--r-- | openpgp-ffi/src/keyid.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openpgp-ffi/src/keyid.rs b/openpgp-ffi/src/keyid.rs index 202335f1..229b97e6 100644 --- a/openpgp-ffi/src/keyid.rs +++ b/openpgp-ffi/src/keyid.rs @@ -57,6 +57,23 @@ fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut openpgp::KeyID { } /// Reads a hex-encoded Key ID. +/// +/// # Example +/// +/// ```c +/// #include <assert.h> +/// #include <stdlib.h> +/// #include <string.h> +/// #include <sequoia/openpgp.h> +/// +/// pgp_keyid_t mr_b = pgp_keyid_from_hex ("bbbbbbbbbbbbbbbb"); +/// +/// char *mr_b_as_string = pgp_keyid_to_string (mr_b); +/// assert (strcmp (mr_b_as_string, "BBBB BBBB BBBB BBBB") == 0); +/// +/// free (mr_b_as_string); +/// pgp_keyid_free (mr_b); +/// ``` #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_keyid_from_hex(id: *const c_char) -> *mut openpgp::KeyID { let id = ffi_param_cstr!(id).to_string_lossy(); |