Skip to main content

llama_cpp_wrapper_sources/
wrapper_header_paths.rs

1use std::path::Path;
2use std::path::PathBuf;
3
4use crate::constants::WRAPPER_HEADERS;
5
6#[must_use]
7pub fn wrapper_header_paths(sys_dir: &Path) -> Vec<PathBuf> {
8    WRAPPER_HEADERS
9        .iter()
10        .map(|wrapper_header| sys_dir.join(wrapper_header))
11        .collect()
12}
13
14#[cfg(test)]
15mod tests {
16    use std::path::Path;
17    use std::path::PathBuf;
18
19    use super::wrapper_header_paths;
20    use crate::constants::WRAPPER_HEADERS;
21
22    #[test]
23    fn every_wrapper_header_is_resolved_against_the_sys_dir() {
24        assert_eq!(
25            wrapper_header_paths(Path::new("/repo/llama-cpp-bindings-sys")),
26            WRAPPER_HEADERS
27                .iter()
28                .map(|header| PathBuf::from("/repo/llama-cpp-bindings-sys").join(header))
29                .collect::<Vec<PathBuf>>()
30        );
31    }
32}