(array: &Vec<Value>, find: &Value)
| 800 | } |
| 801 | |
| 802 | fn array_contains(array: &Vec<Value>, find: &Value) -> bool { |
| 803 | for item in array { |
| 804 | if find.is_boolean() && item.is_boolean() && find.as_bool().unwrap() == item.as_bool().unwrap() { |
| 805 | return true; |
| 806 | } |
| 807 | |
| 808 | if find.is_f64() && item.is_f64() && (find.as_f64().unwrap() - item.as_f64().unwrap()).abs() < 0.1 { |
| 809 | return true; |
| 810 | } |
| 811 | |
| 812 | if find.is_i64() && item.is_i64() && find.as_i64().unwrap() == item.as_i64().unwrap() { |
| 813 | return true; |
| 814 | } |
| 815 | |
| 816 | if find.is_null() && item.is_null() { |
| 817 | return true; |
| 818 | } |
| 819 | |
| 820 | if find.is_number() && item.is_number() && find.as_number().unwrap() == item.as_number().unwrap() { |
| 821 | return true; |
| 822 | } |
| 823 | |
| 824 | if find.is_string() && item.is_string() && find.as_str().unwrap() == item.as_str().unwrap() { |
| 825 | return true; |
| 826 | } |
| 827 | |
| 828 | if find.is_u64() && item.is_u64() && find.as_u64().unwrap() == item.as_u64().unwrap() { |
| 829 | return true; |
| 830 | } |
| 831 | |
| 832 | if find.is_object() && item.is_object() { |
| 833 | let obj_diff = get_diff(find, item); |
| 834 | if obj_diff.is_empty() { |
| 835 | return true; |
| 836 | } |
| 837 | } |
| 838 | |
| 839 | if find.is_array() && item.is_array() && is_same_array(item.as_array().unwrap(), find.as_array().unwrap()) { |
| 840 | return true; |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | false |
| 845 | } |
| 846 | |
| 847 | #[test] |
| 848 | fn same_array() { |
no test coverage detected