summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
-rw-r--r--src/main.rs25
-rw-r--r--src/tests/matrix_test.rs2
3 files changed, 9 insertions, 26 deletions
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
index 0000000..afe3b75
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,8 @@
+mod types;
+
+#[cfg(test)]
+mod tests;
+
+pub fn test() {
+ println!("Testing code here");
+}
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index 0b7000d..0000000
--- a/src/main.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use std::{error::Error, io::stdin, str::FromStr};
-
-#[cfg(test)]
-mod tests;
-
-use types::{matrix::Matrix, matrix_err::ParseMatrixError};
-
-mod types;
-fn handle_input() -> Result<Matrix, ParseMatrixError> {
- let input = stdin();
- let mut construct_string = String::from("");
- loop {
- let mut s = "".to_string();
- let _ = input.read_line(&mut s);
- if s == "exit\n" {
- break;
- }
- construct_string += &s;
- }
- Matrix::from_str(construct_string.trim_end())
-}
-fn main() -> Result<(), Box<dyn Error>> {
- let m = handle_input()?;
- Ok(println!("The matrix is:\n{}", m))
-}
diff --git a/src/tests/matrix_test.rs b/src/tests/matrix_test.rs
index 7a7461a..08ed3a6 100644
--- a/src/tests/matrix_test.rs
+++ b/src/tests/matrix_test.rs
@@ -1,4 +1,4 @@
-use std::{error::Error, str::FromStr};
+use std::str::FromStr;
use crate::types::{matrix::Matrix, matrix_err::ParseMatrixError};