MCPcopy Create free account
hub / github.com/PowerShell/DSC / is_same_array

Function is_same_array

lib/dsc-lib/src/dscresources/dscresource.rs:786–800  ·  view source on GitHub ↗

Compares two arrays independent of order

(expected: &Vec<Value>, actual: &Vec<Value>)

Source from the content-addressed store, hash-verified

784
785/// Compares two arrays independent of order
786fn is_same_array(expected: &Vec<Value>, actual: &Vec<Value>) -> bool {
787 if expected.len() != actual.len() {
788 info!("{}", t!("dscresources.dscresource.diffArraySize"));
789 return false;
790 }
791
792 for item in expected {
793 if !array_contains(actual, item) {
794 info!("{}", t!("dscresources.dscresource.diffMissingItem"));
795 return false;
796 }
797 }
798
799 true
800}
801
802fn array_contains(array: &Vec<Value>, find: &Value) -> bool {
803 for item in array {

Callers 2

get_diffFunction · 0.85
array_containsFunction · 0.85

Calls 1

array_containsFunction · 0.85

Tested by

no test coverage detected