mirror of
https://github.com/loot/loot-condition-interpreter.git
synced 2026-07-27 14:16:09 -07:00
Rename GameType variants to use fewer acronyms
A minor quality of life improvement since the nom 5 update is a breaking change.
This commit is contained in:
+9
-9
@@ -23,7 +23,7 @@ fn generate_plugin_versions() -> Vec<(String, String)> {
|
|||||||
|
|
||||||
fn criterion_benchmark(c: &mut Criterion) {
|
fn criterion_benchmark(c: &mut Criterion) {
|
||||||
c.bench_function("Expression.eval() file(path)", |b| {
|
c.bench_function("Expression.eval() file(path)", |b| {
|
||||||
let state = State::new(GameType::Tes4, ".".into(), ".".into());
|
let state = State::new(GameType::Oblivion, ".".into(), ".".into());
|
||||||
let expression = Expression::from_str("file(\"Cargo.toml\")").unwrap();
|
let expression = Expression::from_str("file(\"Cargo.toml\")").unwrap();
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@@ -32,7 +32,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("Expression.eval() file(regex)", |b| {
|
c.bench_function("Expression.eval() file(regex)", |b| {
|
||||||
let state = State::new(GameType::Tes4, ".".into(), ".".into());
|
let state = State::new(GameType::Oblivion, ".".into(), ".".into());
|
||||||
let expression = Expression::from_str("file(\"Cargo.*\")").unwrap();
|
let expression = Expression::from_str("file(\"Cargo.*\")").unwrap();
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@@ -42,7 +42,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("Expression.eval() active(path)", |b| {
|
c.bench_function("Expression.eval() active(path)", |b| {
|
||||||
let state = State::new(
|
let state = State::new(
|
||||||
GameType::Tes4,
|
GameType::Oblivion,
|
||||||
"tests/testing-plugins/Oblivion/Data".into(),
|
"tests/testing-plugins/Oblivion/Data".into(),
|
||||||
".".into(),
|
".".into(),
|
||||||
)
|
)
|
||||||
@@ -57,7 +57,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("Expression.eval() active(regex)", |b| {
|
c.bench_function("Expression.eval() active(regex)", |b| {
|
||||||
let state = State::new(
|
let state = State::new(
|
||||||
GameType::Tes4,
|
GameType::Oblivion,
|
||||||
"tests/testing-plugins/Oblivion/Data".into(),
|
"tests/testing-plugins/Oblivion/Data".into(),
|
||||||
".".into(),
|
".".into(),
|
||||||
)
|
)
|
||||||
@@ -71,7 +71,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("Expression.eval() many()", |b| {
|
c.bench_function("Expression.eval() many()", |b| {
|
||||||
let state = State::new(GameType::Tes4, ".".into(), ".".into());
|
let state = State::new(GameType::Oblivion, ".".into(), ".".into());
|
||||||
let expression = Expression::from_str("many(\"Cargo.*\")").unwrap();
|
let expression = Expression::from_str("many(\"Cargo.*\")").unwrap();
|
||||||
|
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
@@ -81,7 +81,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("Expression.eval() many_active()", |b| {
|
c.bench_function("Expression.eval() many_active()", |b| {
|
||||||
let state = State::new(
|
let state = State::new(
|
||||||
GameType::Tes4,
|
GameType::Oblivion,
|
||||||
"tests/testing-plugins/Oblivion/Data".into(),
|
"tests/testing-plugins/Oblivion/Data".into(),
|
||||||
".".into(),
|
".".into(),
|
||||||
)
|
)
|
||||||
@@ -96,7 +96,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("Expression.eval() checksum()", |b| {
|
c.bench_function("Expression.eval() checksum()", |b| {
|
||||||
let state = State::new(
|
let state = State::new(
|
||||||
GameType::Tes4,
|
GameType::Oblivion,
|
||||||
"tests/testing-plugins/Oblivion/Data".into(),
|
"tests/testing-plugins/Oblivion/Data".into(),
|
||||||
".".into(),
|
".".into(),
|
||||||
);
|
);
|
||||||
@@ -109,7 +109,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
|
|
||||||
c.bench_function("Expression.eval() version(plugin)", |b| {
|
c.bench_function("Expression.eval() version(plugin)", |b| {
|
||||||
let state = State::new(
|
let state = State::new(
|
||||||
GameType::Tes4,
|
GameType::Oblivion,
|
||||||
"tests/testing-plugins/Oblivion/Data".into(),
|
"tests/testing-plugins/Oblivion/Data".into(),
|
||||||
".".into(),
|
".".into(),
|
||||||
)
|
)
|
||||||
@@ -123,7 +123,7 @@ fn criterion_benchmark(c: &mut Criterion) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("Expression.eval() version(executable)", |b| {
|
c.bench_function("Expression.eval() version(executable)", |b| {
|
||||||
let state = State::new(GameType::Tes4, ".".into(), ".".into());
|
let state = State::new(GameType::Oblivion, ".".into(), ".".into());
|
||||||
let expression = Expression::from_str(
|
let expression = Expression::from_str(
|
||||||
"version(\"tests/loot_api_win32/loot_api.dll\", \"0.13.8.0\", ==)",
|
"version(\"tests/loot_api_win32/loot_api.dll\", \"0.13.8.0\", ==)",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,39 +40,39 @@ pub static LCI_ERROR_TEXT_ENCODE_FAIL: c_int = -7;
|
|||||||
|
|
||||||
/// Game code for The Elder Scrolls III: Morrowind.
|
/// Game code for The Elder Scrolls III: Morrowind.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_TES3: c_int = GameType::Tes3 as c_int;
|
pub static LCI_GAME_TES3: c_int = GameType::Morrowind as c_int;
|
||||||
|
|
||||||
/// Game code for The Elder Scrolls IV: Oblivion.
|
/// Game code for The Elder Scrolls IV: Oblivion.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_TES4: c_int = GameType::Tes4 as c_int;
|
pub static LCI_GAME_TES4: c_int = GameType::Oblivion as c_int;
|
||||||
|
|
||||||
/// Game code for The Elder Scrolls V: Skyrim.
|
/// Game code for The Elder Scrolls V: Skyrim.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_TES5: c_int = GameType::Tes5 as c_int;
|
pub static LCI_GAME_TES5: c_int = GameType::Skyrim as c_int;
|
||||||
|
|
||||||
/// Game code for Fallout 3.
|
/// Game code for Fallout 3.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_FO3: c_int = GameType::Fo3 as c_int;
|
pub static LCI_GAME_FO3: c_int = GameType::Fallout3 as c_int;
|
||||||
|
|
||||||
/// Game code for Fallout: New Vegas.
|
/// Game code for Fallout: New Vegas.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_FNV: c_int = GameType::Fonv as c_int;
|
pub static LCI_GAME_FNV: c_int = GameType::FalloutNV as c_int;
|
||||||
|
|
||||||
/// Game code for Fallout 4.
|
/// Game code for Fallout 4.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_FO4: c_int = GameType::Fo4 as c_int;
|
pub static LCI_GAME_FO4: c_int = GameType::Fallout4 as c_int;
|
||||||
|
|
||||||
/// Game code for The Elder Scrolls V: Skyrim Special Edition.
|
/// Game code for The Elder Scrolls V: Skyrim Special Edition.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_TES5SE: c_int = GameType::Tes5se as c_int;
|
pub static LCI_GAME_TES5SE: c_int = GameType::SkyrimSE as c_int;
|
||||||
|
|
||||||
/// Game code for The Elder Scrolls V: Skyrim VR.
|
/// Game code for The Elder Scrolls V: Skyrim VR.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_TES5VR: c_int = GameType::Tes5vr as c_int;
|
pub static LCI_GAME_TES5VR: c_int = GameType::SkyrimVR as c_int;
|
||||||
|
|
||||||
/// Game code for Fallout 4 VR.
|
/// Game code for Fallout 4 VR.
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub static LCI_GAME_FO4VR: c_int = GameType::Fo4vr as c_int;
|
pub static LCI_GAME_FO4VR: c_int = GameType::Fallout4VR as c_int;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|||||||
+9
-9
@@ -32,15 +32,15 @@ fn map_error(err: &Error) -> c_int {
|
|||||||
|
|
||||||
pub fn map_game_type(game_type: c_int) -> Result<GameType, c_int> {
|
pub fn map_game_type(game_type: c_int) -> Result<GameType, c_int> {
|
||||||
match game_type {
|
match game_type {
|
||||||
x if x == LCI_GAME_TES3 => Ok(GameType::Tes3),
|
x if x == LCI_GAME_TES3 => Ok(GameType::Morrowind),
|
||||||
x if x == LCI_GAME_TES4 => Ok(GameType::Tes4),
|
x if x == LCI_GAME_TES4 => Ok(GameType::Oblivion),
|
||||||
x if x == LCI_GAME_TES5 => Ok(GameType::Tes5),
|
x if x == LCI_GAME_TES5 => Ok(GameType::Skyrim),
|
||||||
x if x == LCI_GAME_TES5SE => Ok(GameType::Tes5se),
|
x if x == LCI_GAME_TES5SE => Ok(GameType::SkyrimSE),
|
||||||
x if x == LCI_GAME_TES5VR => Ok(GameType::Tes5vr),
|
x if x == LCI_GAME_TES5VR => Ok(GameType::SkyrimVR),
|
||||||
x if x == LCI_GAME_FO3 => Ok(GameType::Fo3),
|
x if x == LCI_GAME_FO3 => Ok(GameType::Fallout3),
|
||||||
x if x == LCI_GAME_FNV => Ok(GameType::Fonv),
|
x if x == LCI_GAME_FNV => Ok(GameType::FalloutNV),
|
||||||
x if x == LCI_GAME_FO4 => Ok(GameType::Fo4),
|
x if x == LCI_GAME_FO4 => Ok(GameType::Fallout4),
|
||||||
x if x == LCI_GAME_FO4VR => Ok(GameType::Fo4vr),
|
x if x == LCI_GAME_FO4VR => Ok(GameType::Fallout4VR),
|
||||||
_ => Err(LCI_ERROR_INVALID_ARGS),
|
_ => Err(LCI_ERROR_INVALID_ARGS),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
State {
|
State {
|
||||||
game_type: GameType::Tes4,
|
game_type: GameType::Oblivion,
|
||||||
data_path,
|
data_path,
|
||||||
loot_path: loot_path.into(),
|
loot_path: loot_path.into(),
|
||||||
active_plugins: active_plugins
|
active_plugins: active_plugins
|
||||||
|
|||||||
+94
-92
@@ -37,21 +37,23 @@ type ParsingResult<'a, T> = IResult<&'a str, T, ParsingError<&'a str>>;
|
|||||||
// constants in the C API.
|
// constants in the C API.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub enum GameType {
|
pub enum GameType {
|
||||||
Tes4,
|
Oblivion,
|
||||||
Tes5,
|
Skyrim,
|
||||||
Tes5se,
|
SkyrimSE,
|
||||||
Tes5vr,
|
SkyrimVR,
|
||||||
Fo3,
|
Fallout3,
|
||||||
Fonv,
|
FalloutNV,
|
||||||
Fo4,
|
Fallout4,
|
||||||
Fo4vr,
|
Fallout4VR,
|
||||||
Tes3,
|
Morrowind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GameType {
|
impl GameType {
|
||||||
fn supports_light_plugins(self) -> bool {
|
fn supports_light_plugins(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
GameType::Tes5se | GameType::Tes5vr | GameType::Fo4 | GameType::Fo4vr => true,
|
GameType::SkyrimSE | GameType::SkyrimVR | GameType::Fallout4 | GameType::Fallout4VR => {
|
||||||
|
true
|
||||||
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,7 +297,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
State {
|
State {
|
||||||
game_type: GameType::Tes4,
|
game_type: GameType::Oblivion,
|
||||||
data_path,
|
data_path,
|
||||||
loot_path: PathBuf::new(),
|
loot_path: PathBuf::new(),
|
||||||
active_plugins: HashSet::new(),
|
active_plugins: HashSet::new(),
|
||||||
@@ -307,100 +309,100 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_supports_light_plugins_should_be_true_for_tes5se_tes5vr_fo4_and_fo4vr() {
|
fn game_type_supports_light_plugins_should_be_true_for_tes5se_tes5vr_fo4_and_fo4vr() {
|
||||||
assert!(GameType::Tes5se.supports_light_plugins());
|
assert!(GameType::SkyrimSE.supports_light_plugins());
|
||||||
assert!(GameType::Tes5vr.supports_light_plugins());
|
assert!(GameType::SkyrimVR.supports_light_plugins());
|
||||||
assert!(GameType::Fo4.supports_light_plugins());
|
assert!(GameType::Fallout4.supports_light_plugins());
|
||||||
assert!(GameType::Fo4vr.supports_light_plugins());
|
assert!(GameType::Fallout4VR.supports_light_plugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_supports_light_master_should_be_false_for_tes3_to_5_fo3_and_fonv() {
|
fn game_type_supports_light_master_should_be_false_for_tes3_to_5_fo3_and_fonv() {
|
||||||
assert!(!GameType::Tes3.supports_light_plugins());
|
assert!(!GameType::Morrowind.supports_light_plugins());
|
||||||
assert!(!GameType::Tes4.supports_light_plugins());
|
assert!(!GameType::Oblivion.supports_light_plugins());
|
||||||
assert!(!GameType::Tes5.supports_light_plugins());
|
assert!(!GameType::Skyrim.supports_light_plugins());
|
||||||
assert!(!GameType::Fo3.supports_light_plugins());
|
assert!(!GameType::Fallout3.supports_light_plugins());
|
||||||
assert!(!GameType::Fonv.supports_light_plugins());
|
assert!(!GameType::FalloutNV.supports_light_plugins());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_true_for_esp_for_all_game_types() {
|
fn game_type_is_plugin_filename_should_be_true_for_esp_for_all_game_types() {
|
||||||
let filename = Path::new("Blank.esp");
|
let filename = Path::new("Blank.esp");
|
||||||
|
|
||||||
assert!(GameType::Tes3.is_plugin_filename(filename));
|
assert!(GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes4.is_plugin_filename(filename));
|
assert!(GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5.is_plugin_filename(filename));
|
assert!(GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo3.is_plugin_filename(filename));
|
assert!(GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fonv.is_plugin_filename(filename));
|
assert!(GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_true_for_esm_for_all_game_types() {
|
fn game_type_is_plugin_filename_should_be_true_for_esm_for_all_game_types() {
|
||||||
let filename = Path::new("Blank.esm");
|
let filename = Path::new("Blank.esm");
|
||||||
|
|
||||||
assert!(GameType::Tes3.is_plugin_filename(filename));
|
assert!(GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes4.is_plugin_filename(filename));
|
assert!(GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5.is_plugin_filename(filename));
|
assert!(GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo3.is_plugin_filename(filename));
|
assert!(GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fonv.is_plugin_filename(filename));
|
assert!(GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_true_for_esl_for_tes5se_tes5vr_fo4_and_fo4vr() {
|
fn game_type_is_plugin_filename_should_be_true_for_esl_for_tes5se_tes5vr_fo4_and_fo4vr() {
|
||||||
let filename = Path::new("Blank.esl");
|
let filename = Path::new("Blank.esl");
|
||||||
|
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_false_for_esl_for_tes3_to_5_fo3_and_fonv() {
|
fn game_type_is_plugin_filename_should_be_false_for_esl_for_tes3_to_5_fo3_and_fonv() {
|
||||||
let filename = Path::new("Blank.esl");
|
let filename = Path::new("Blank.esl");
|
||||||
|
|
||||||
assert!(!GameType::Tes3.is_plugin_filename(filename));
|
assert!(!GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes4.is_plugin_filename(filename));
|
assert!(!GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5.is_plugin_filename(filename));
|
assert!(!GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo3.is_plugin_filename(filename));
|
assert!(!GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fonv.is_plugin_filename(filename));
|
assert!(!GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_true_for_esp_dot_ghost_for_all_game_types() {
|
fn game_type_is_plugin_filename_should_be_true_for_esp_dot_ghost_for_all_game_types() {
|
||||||
let filename = Path::new("Blank.esp.ghost");
|
let filename = Path::new("Blank.esp.ghost");
|
||||||
|
|
||||||
assert!(GameType::Tes3.is_plugin_filename(filename));
|
assert!(GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes4.is_plugin_filename(filename));
|
assert!(GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5.is_plugin_filename(filename));
|
assert!(GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo3.is_plugin_filename(filename));
|
assert!(GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fonv.is_plugin_filename(filename));
|
assert!(GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_true_for_esm_dot_ghost_for_all_game_types() {
|
fn game_type_is_plugin_filename_should_be_true_for_esm_dot_ghost_for_all_game_types() {
|
||||||
let filename = Path::new("Blank.esm.ghost");
|
let filename = Path::new("Blank.esm.ghost");
|
||||||
|
|
||||||
assert!(GameType::Tes3.is_plugin_filename(filename));
|
assert!(GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes4.is_plugin_filename(filename));
|
assert!(GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5.is_plugin_filename(filename));
|
assert!(GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo3.is_plugin_filename(filename));
|
assert!(GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fonv.is_plugin_filename(filename));
|
assert!(GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -408,36 +410,36 @@ mod tests {
|
|||||||
) {
|
) {
|
||||||
let filename = Path::new("Blank.esl.ghost");
|
let filename = Path::new("Blank.esl.ghost");
|
||||||
|
|
||||||
assert!(GameType::Tes5se.is_plugin_filename(filename));
|
assert!(GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4.is_plugin_filename(filename));
|
assert!(GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_false_for_esl_dot_ghost_for_tes3_to_5_fo3_and_fonv() {
|
fn game_type_is_plugin_filename_should_be_false_for_esl_dot_ghost_for_tes3_to_5_fo3_and_fonv() {
|
||||||
let filename = Path::new("Blank.esl.ghost");
|
let filename = Path::new("Blank.esl.ghost");
|
||||||
|
|
||||||
assert!(!GameType::Tes3.is_plugin_filename(filename));
|
assert!(!GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes4.is_plugin_filename(filename));
|
assert!(!GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5.is_plugin_filename(filename));
|
assert!(!GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo3.is_plugin_filename(filename));
|
assert!(!GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fonv.is_plugin_filename(filename));
|
assert!(!GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn game_type_is_plugin_filename_should_be_false_for_non_esp_esm_esl_for_all_game_types() {
|
fn game_type_is_plugin_filename_should_be_false_for_non_esp_esm_esl_for_all_game_types() {
|
||||||
let filename = Path::new("Blank.txt");
|
let filename = Path::new("Blank.txt");
|
||||||
|
|
||||||
assert!(!GameType::Tes3.is_plugin_filename(filename));
|
assert!(!GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes4.is_plugin_filename(filename));
|
assert!(!GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5.is_plugin_filename(filename));
|
assert!(!GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5se.is_plugin_filename(filename));
|
assert!(!GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(!GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo3.is_plugin_filename(filename));
|
assert!(!GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fonv.is_plugin_filename(filename));
|
assert!(!GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo4.is_plugin_filename(filename));
|
assert!(!GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(!GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -445,15 +447,15 @@ mod tests {
|
|||||||
) {
|
) {
|
||||||
let filename = Path::new("Blank.txt.ghost");
|
let filename = Path::new("Blank.txt.ghost");
|
||||||
|
|
||||||
assert!(!GameType::Tes3.is_plugin_filename(filename));
|
assert!(!GameType::Morrowind.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes4.is_plugin_filename(filename));
|
assert!(!GameType::Oblivion.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5.is_plugin_filename(filename));
|
assert!(!GameType::Skyrim.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5se.is_plugin_filename(filename));
|
assert!(!GameType::SkyrimSE.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Tes5vr.is_plugin_filename(filename));
|
assert!(!GameType::SkyrimVR.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo3.is_plugin_filename(filename));
|
assert!(!GameType::Fallout3.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fonv.is_plugin_filename(filename));
|
assert!(!GameType::FalloutNV.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo4.is_plugin_filename(filename));
|
assert!(!GameType::Fallout4.is_plugin_filename(filename));
|
||||||
assert!(!GameType::Fo4vr.is_plugin_filename(filename));
|
assert!(!GameType::Fallout4VR.is_plugin_filename(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user