blob: d0feb98e2a799808fe695d555ac1c101237e150e [file] [log] [blame]
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//! Integration tests of the library libfdt.
use libfdt::Fdt;
use std::fs;
use std::ops::Range;
const TEST_TREE1_PATH: &str = "data/test_tree1.dtb";
#[test]
fn parse_well_formed_fdt_successfully() {
let data = fs::read(TEST_TREE1_PATH).unwrap();
let fdt = Fdt::from_slice(&data).unwrap();
const EXPECTED_FIRST_MEMORY_RANGE: Range<usize> = 0..256;
let mut memory = fdt.memory().unwrap().unwrap();
assert_eq!(memory.next(), Some(EXPECTED_FIRST_MEMORY_RANGE));
}