impemented mock testing
This commit is contained in:
35
tests/config_merge_test.rs
Normal file
35
tests/config_merge_test.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
#[path = "../src/engine/formatters/throttled.rs"]
|
||||
mod throttled;
|
||||
|
||||
use throttled::{ThrottledTranslator, ThrottledConfig};
|
||||
use std::fs;
|
||||
|
||||
#[test]
|
||||
fn test_throttled_formatter_non_destructive() {
|
||||
let fixture_path = "tests/fixtures/throttled.conf";
|
||||
let existing_content = fs::read_to_string(fixture_path).expect("Failed to read fixture");
|
||||
|
||||
let config = ThrottledConfig {
|
||||
pl1_limit: 25.0,
|
||||
pl2_limit: 35.0,
|
||||
trip_temp: 90.0,
|
||||
};
|
||||
|
||||
let merged = ThrottledTranslator::merge_conf(&existing_content, &config);
|
||||
|
||||
// Assert updates
|
||||
assert!(merged.contains("PL1_Tdp_W: 25"));
|
||||
assert!(merged.contains("PL2_Tdp_W: 35"));
|
||||
assert!(merged.contains("Trip_Temp_C: 90"));
|
||||
|
||||
// Assert preservation
|
||||
assert!(merged.contains("[UNDERVOLT]"));
|
||||
assert!(merged.contains("CORE: -100"));
|
||||
assert!(merged.contains("GPU: -50"));
|
||||
assert!(merged.contains("# Important: Preserving undervolt offsets is critical!"));
|
||||
assert!(merged.contains("Update_Interval_ms: 3000"));
|
||||
|
||||
// Check that we didn't lose the [GENERAL] section
|
||||
assert!(merged.contains("[GENERAL]"));
|
||||
assert!(merged.contains("# This is a complex test fixture"));
|
||||
}
|
||||
Reference in New Issue
Block a user