Changed constructor to allow any string slice as parameter + started writing unit tests

This commit is contained in:
François Autin 2023-03-09 12:44:03 +01:00
parent 26b75ffe8d
commit eeac26aba6
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -23,9 +23,9 @@ pub struct Thread {
impl Thread { impl Thread {
/// Thread constructor /// Thread constructor
pub fn new(name: String) -> Self { pub fn new(name: &str) -> Self {
Self { Self {
name, name: String::from(name),
process: None, process: None,
// simulation_context: UContextT::new(), // simulation_context: UContextT::new(),
thread_context: ThreadContext { thread_context: ThreadContext {
@ -99,3 +99,14 @@ impl Drop for Thread {
fn start_thread_execution() { fn start_thread_execution() {
} }
#[cfg(test)]
mod test {
use super::Thread;
fn get_new_thread() -> Thread {
Thread::new("test_thread")
}
}