librashader/librashader-presets/tests/parse_all.rs

35 lines
1.1 KiB
Rust
Raw Normal View History

use glob::glob;
2024-02-09 13:33:17 +11:00
use librashader_presets::context::{ContextItem, VideoDriver, WildcardContext};
use librashader_presets::ShaderPreset;
#[test]
fn parses_all_slang_presets() {
2023-02-24 15:57:20 +11:00
for entry in glob("../test/shaders_slang/**/*.slangp").unwrap() {
if let Ok(path) = entry {
if let Err(e) = ShaderPreset::try_parse(&path) {
println!("Could not parse {}: {:?}", path.display(), e)
}
}
}
}
#[test]
fn parses_problematic() {
2023-02-24 15:57:20 +11:00
let path = "../test/Mega_Bezel_Packs/Duimon-Mega-Bezel/Presets/Advanced/Nintendo_NDS_DREZ/NDS-[DREZ]-[Native]-[ADV]-[Guest]-[Night].slangp";
2023-04-23 15:13:31 +10:00
ShaderPreset::try_parse(path).expect(&format!("Failed to parse {}", path));
}
2024-02-09 13:33:17 +11:00
#[test]
fn parses_wildcard() {
let path =
"../test/shaders_slang/bezel/Mega_Bezel/resource/wildcard-examples/Preset-01-Core.slangp";
let mut context = WildcardContext::new();
context.add_video_driver_defaults(VideoDriver::Vulkan);
context.append_item(ContextItem::CoreName(String::from("image display")));
ShaderPreset::try_parse_with_context(path, context)
.expect(&format!("Failed to parse {}", path));
}