From 50d0d9e47bb0a7d41af548b5de5fab3e714c7dbc Mon Sep 17 00:00:00 2001 From: Philipp Keck Date: Tue, 17 Jul 2018 20:34:31 +0200 Subject: [PATCH 1/3] Replace main() with unit test. This converts the project from a binary to a library --- src/lib.rs | 13 +++++++++++++ src/main.rs | 9 --------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 src/lib.rs delete mode 100644 src/main.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..5386bce --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,13 @@ +extern crate base64; +extern crate ring; + +mod string_encryption_key_based_symmetric; + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + // This test simply simply runs all the examples to ensure that they compile and work. + ::string_encryption_key_based_symmetric::main(); + } +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 2dedfc0..0000000 --- a/src/main.rs +++ /dev/null @@ -1,9 +0,0 @@ -extern crate base64; -extern crate ring; - -mod string_encryption_key_based_symmetric; - -fn main() { - // This main method simply runs all the examples to ensure that they compile and work. - ::string_encryption_key_based_symmetric::main(); -} From d36eae34fa61ac034b20a54d005cc19bbb0a4b3a Mon Sep 17 00:00:00 2001 From: "Kai Mindermann M.Sc" Date: Wed, 18 Jul 2018 12:33:37 +0200 Subject: [PATCH 2/3] Update and rename lib.rs to tests.rs --- src/lib.rs | 13 ------------- src/tests.rs | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 src/lib.rs create mode 100644 src/tests.rs diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 5386bce..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -extern crate base64; -extern crate ring; - -mod string_encryption_key_based_symmetric; - -#[cfg(test)] -mod tests { - #[test] - fn it_works() { - // This test simply simply runs all the examples to ensure that they compile and work. - ::string_encryption_key_based_symmetric::main(); - } -} \ No newline at end of file diff --git a/src/tests.rs b/src/tests.rs new file mode 100644 index 0000000..617d2ce --- /dev/null +++ b/src/tests.rs @@ -0,0 +1,14 @@ +extern crate base64; +extern crate ring; + +mod string_encryption_key_based_symmetric; + +#[cfg(test)] +mod tests { + #[test] + fn test_tring_encryption_key_based_symmetric() { + // This test runs all the examples to ensure that they compile and work. + ::string_encryption_key_based_symmetric::main(); + // TODO check program output contains a line stating that the encryption and decryption worked + } +} From 3eb0d5552f4b39bef29ef57aeff47eb4735c56c4 Mon Sep 17 00:00:00 2001 From: "Kai Mindermann M.Sc" Date: Wed, 18 Jul 2018 12:37:46 +0200 Subject: [PATCH 3/3] Rename tests.rs to lib.rs --- src/{tests.rs => lib.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{tests.rs => lib.rs} (100%) diff --git a/src/tests.rs b/src/lib.rs similarity index 100% rename from src/tests.rs rename to src/lib.rs