1#![forbid(unsafe_code)]
48
49#[macro_use]
50#[allow(unused_macros, clippy::duplicated_attributes)]
51mod generated_contracts;
52
53pub mod audit;
54pub mod data;
55pub mod error;
56pub mod generator;
57pub mod grammar;
58pub mod ml;
59pub mod mutator;
60pub mod oracle;
61pub mod transpiler;
62
63use serde::{Deserialize, Serialize};
64
65pub use error::{Error, Result};
66
67pub use audit::{
69 new_audit_collector, AuditCollector, AuditStats, AuditTrace, ChainVerification,
70 ExecutionSummary, HashChainEntry, VerificationPath, VerificationTimer,
71};
72
73#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
75pub enum Language {
76 Python,
78 Bash,
80 C,
82 TypeScript,
84 Ruchy,
86 Rust,
88}
89
90impl std::fmt::Display for Language {
91 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
92 match self {
93 Self::Python => write!(f, "python"),
94 Self::Bash => write!(f, "bash"),
95 Self::C => write!(f, "c"),
96 Self::TypeScript => write!(f, "typescript"),
97 Self::Ruchy => write!(f, "ruchy"),
98 Self::Rust => write!(f, "rust"),
99 }
100 }
101}
102
103#[cfg(test)]
104mod tests {
105 use super::*;
106
107 #[test]
108 fn test_language_display_python() {
109 assert_eq!(format!("{}", Language::Python), "python");
110 }
111
112 #[test]
113 fn test_language_display_bash() {
114 assert_eq!(format!("{}", Language::Bash), "bash");
115 }
116
117 #[test]
118 fn test_language_display_c() {
119 assert_eq!(format!("{}", Language::C), "c");
120 }
121
122 #[test]
123 fn test_language_display_ruchy() {
124 assert_eq!(format!("{}", Language::Ruchy), "ruchy");
125 }
126
127 #[test]
128 fn test_language_display_rust() {
129 assert_eq!(format!("{}", Language::Rust), "rust");
130 }
131
132 #[test]
133 fn test_language_display_typescript() {
134 assert_eq!(format!("{}", Language::TypeScript), "typescript");
135 }
136
137 #[test]
138 fn test_language_clone() {
139 let lang = Language::Python;
140 let cloned = lang.clone();
141 assert_eq!(lang, cloned);
142 }
143
144 #[test]
145 fn test_language_copy() {
146 let lang = Language::Python;
147 let copied = lang;
148 assert_eq!(lang, copied);
149 }
150
151 #[test]
152 fn test_language_debug() {
153 let debug_str = format!("{:?}", Language::Python);
154 assert!(debug_str.contains("Python"));
155 }
156}
157
158pub mod prelude {
160 pub use crate::generator::{Generator, SamplingStrategy};
161 pub use crate::mutator::{MutationOperator, Mutator};
162 pub use crate::oracle::{Oracle, Verdict, VerificationResult};
163 pub use crate::transpiler::{
164 Transpiler, TranspilerConfig, TranspilerOracle, TranspilerVerdict, VerificationStats,
165 };
166 pub use crate::{Error, Language, Result};
167}