Skip to main content

llama_cpp_wrapper_sources/
wrapper_source_paths.rs

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