rs_teststand/expression/function/
other.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub enum OtherFunction {
8 AllOf,
10 AnyOf,
12 CheckLimits,
14 ConvertColor,
16 CurrentUserHasPrivilege,
18 Enum,
20 Evaluate,
22 FindFile,
24 GetEngine,
26 NoValidation,
28 OutputMessage,
30 Rgb,
32 TargetName,
34}
35
36impl OtherFunction {
37 pub const ALL: [Self; 13] = [
39 Self::AllOf,
40 Self::AnyOf,
41 Self::CheckLimits,
42 Self::ConvertColor,
43 Self::CurrentUserHasPrivilege,
44 Self::Enum,
45 Self::Evaluate,
46 Self::FindFile,
47 Self::GetEngine,
48 Self::NoValidation,
49 Self::OutputMessage,
50 Self::Rgb,
51 Self::TargetName,
52 ];
53
54 #[must_use]
56 pub const fn name(self) -> &'static str {
57 match self {
58 Self::AllOf => "AllOf",
59 Self::AnyOf => "AnyOf",
60 Self::CheckLimits => "CheckLimits",
61 Self::ConvertColor => "ConvertColor",
62 Self::CurrentUserHasPrivilege => "CurrentUserHasPrivilege",
63 Self::Enum => "Enum",
64 Self::Evaluate => "Evaluate",
65 Self::FindFile => "FindFile",
66 Self::GetEngine => "GetEngine",
67 Self::NoValidation => "NoValidation",
68 Self::OutputMessage => "OutputMessage",
69 Self::Rgb => "RGB",
70 Self::TargetName => "TargetName",
71 }
72 }
73}
74
75#[cfg(test)]
76mod tests {
77 use super::OtherFunction;
78
79 #[test]
80 fn every_name_is_distinct() {
81 let mut names: Vec<&str> = OtherFunction::ALL.iter().map(|f| f.name()).collect();
82 names.sort_unstable();
83 let count = names.len();
84 names.dedup();
85 assert_eq!(names.len(), count);
86 }
87}