Skip to content

Commit

Permalink
Resolve conflicts by rebasing the main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
chanijjani committed Mar 15, 2024
1 parent 64de6ef commit e7476e0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 25 deletions.
25 changes: 16 additions & 9 deletions rust/rti/src/federate_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ mod tests {
}

#[test]
fn test_e_positive() {
fn test_enclave_positive() {
let federate_info = FederateInfo::new();
let e = federate_info.e();
assert!(e == &SchedulingNode::new());
let enclave = federate_info.enclave();
assert!(enclave == &SchedulingNode::new());
}

#[test]
fn test_enclave_positive() {
fn test_enclave_mut_positive() {
let mut federate_info = FederateInfo::new();
let enclave = federate_info.enclave();
assert!(enclave == &SchedulingNode::new());
let enclave_mut = federate_info.enclave_mut();
assert!(enclave_mut == &mut SchedulingNode::new());
}

#[test]
Expand All @@ -176,10 +176,17 @@ mod tests {
}

#[test]
fn test_in_transit_message_tags_positive() {
fn test_in_transit_message_queue_positive() {
let federate_info = FederateInfo::new();
let in_transit_message_tags = federate_info.in_transit_message_queue();
assert!(in_transit_message_tags == &InTransitMessageQueue::new())
}

#[test]
fn test_in_transit_message_queue_mut_positive() {
let mut federate_info = FederateInfo::new();
let in_transit_message_tags = federate_info.in_transit_message_tags();
assert!(in_transit_message_tags == &mut InTransitMessageRecordQueue::new())
let in_transit_message_tags = federate_info.in_transit_message_queue_mut();
assert!(in_transit_message_tags == &mut InTransitMessageQueue::new())
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions rust/rti/src/in_transit_message_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::RTIRemote;

use std::sync::{Arc, RwLock};

#[derive(PartialEq)]
pub struct InTransitMessageQueue {
queue: PriorityQueue<Tag, usize>,
}
Expand Down
22 changes: 11 additions & 11 deletions rust/rti/src/rti_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let sent_start_time = Arc::new((Mutex::new(false), Condvar::new()));
let cloned_sent_start_time = Arc::clone(&sent_start_time);
Expand All @@ -1610,7 +1610,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let sent_start_time = Arc::new((Mutex::new(false), Condvar::new()));
let cloned_sent_start_time = Arc::clone(&sent_start_time);
Expand All @@ -1626,7 +1626,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
SchedulingNode::tag_advance_grant_if_safe(cloned_rti, 0, 0);
}
Expand All @@ -1640,7 +1640,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let result = SchedulingNode::is_in_zero_delay_cycle(cloned_rti, 0);
assert!(result == false);
Expand All @@ -1655,7 +1655,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let sent_start_time = Arc::new((Mutex::new(false), Condvar::new()));
let cloned_sent_start_time = Arc::clone(&sent_start_time);
Expand All @@ -1677,7 +1677,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let sent_start_time = Arc::new((Mutex::new(false), Condvar::new()));
let cloned_sent_start_time = Arc::clone(&sent_start_time);
Expand All @@ -1700,7 +1700,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
SchedulingNode::earliest_future_incoming_message_tag(cloned_rti, 0, 0);
}
Expand All @@ -1714,7 +1714,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
SchedulingNode::update_min_delays_upstream(cloned_rti, 0);
}
Expand All @@ -1728,7 +1728,7 @@ mod tests {
args.push(NUMBER_OF_FEDEATES.to_string());
let _ = process_args(&mut rti, &args);
initialize_federates(&mut rti);
let arc_rti = Arc::new(Mutex::new(rti));
let arc_rti = Arc::new(RwLock::new(rti));
let cloned_rti = Arc::clone(&arc_rti);
let sent_start_time = Arc::new((Mutex::new(false), Condvar::new()));
let cloned_sent_start_time = Arc::clone(&sent_start_time);
Expand All @@ -1741,11 +1741,11 @@ mod tests {
Tag::never_tag(),
);
}

#[test]
// TODO: Better tp seperate each assert into a unit test, respectively.
fn test_rti_common_positive() {
let mut rti_common = RTICommon::new();
let rti_common = RTICommon::new();
assert!(rti_common.scheduling_nodes().len() == 0);
assert!(rti_common.number_of_scheduling_nodes() == 0);
assert!(rti_common.max_stop_tag() == Tag::never_tag());
Expand Down
9 changes: 4 additions & 5 deletions rust/rti/src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ mod tests {
assert_eq!(nv_tag, Tag::lf_tag_add(&t6, &t7));
*/
}

#[test]
fn test_lf_delay_tag() {
let t1 = Tag::new(NEVER, 0);
let t2 = Tag::new(FOREVER, 2);
let int_1: Interval = Some(2);
let int_2: Interval = Some(-2);
let t3 = Tag::new(34, 4);
let t3 = Tag::new(34, 4);
let int_3: Interval = Some(0);

let fv_tag = Tag::forever_tag();
Expand All @@ -310,7 +310,6 @@ mod tests {
r2.set_time(t3.time() + int_1.unwrap());
r2.set_microstep(0);
assert_eq!(r2, Tag::lf_delay_tag(&t3, int_1));

}

#[test]
Expand Down Expand Up @@ -351,10 +350,10 @@ mod tests {
r1.set_microstep(t2.microstep() + 1);

assert_eq!(r1, Tag::lf_delay_tag(&t2, int_6));

r3.set_microstep(r3.microstep() + 1);
assert_eq!(r3, Tag::lf_delay_tag(&zr_tag, int_6));

//TODO: Check why this is failing:
//r4.set_time(t2.time() - 1);
//r4.set_microstep(u32::MAX);
Expand Down

0 comments on commit e7476e0

Please sign in to comment.