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 d392c69535
commit 0f339dd936
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

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