1pub mod types;
4pub mod schema;
5pub mod schema_validator;
6pub mod ir;
8pub mod prelude {
9 pub use crate::types::*;
11 pub use crate::schema::*;
12 pub use crate::schema_validator::*;
13 pub use crate::ir::*;
15}
16
17#[cfg(test)]
18mod tests {
19 use super::*;
20 use crate::types::*;
21
22 #[test]
23 fn test_value_serialization() {
24 let null_val = Value::Null;
26 let json = serde_json::to_string(&null_val).unwrap();
27 assert_eq!(json, "null");
28
29 let bool_val = Value::Bool(true);
30 let json = serde_json::to_string(&bool_val).unwrap();
31 assert_eq!(json, "true");
32
33 let int_val = Value::Int(42);
34 let json = serde_json::to_string(&int_val).unwrap();
35 assert_eq!(json, "42");
36
37 let str_val = Value::String("hello".to_string());
38 let json = serde_json::to_string(&str_val).unwrap();
39 assert_eq!(json, "\"hello\"");
40 }
41
42 #[test]
43 fn test_value_deserialization() {
44 let null_val: Value = serde_json::from_str("null").unwrap();
46 assert_eq!(null_val, Value::Null);
47
48 let bool_val: Value = serde_json::from_str("true").unwrap();
49 assert_eq!(bool_val, Value::Bool(true));
50
51 let int_val: Value = serde_json::from_str("42").unwrap();
52 assert_eq!(int_val, Value::Int(42));
53
54 let str_val: Value = serde_json::from_str("\"hello\"").unwrap();
55 assert_eq!(str_val, Value::String("hello".to_string()));
56 }
57
58 #[test]
59 fn test_content_hash() {
60 let data = [42u8; 32];
62 let hash = ContentHash::sha256(data);
63 assert!(!hash.0.is_empty());
64
65 let hash2 = ContentHash::sha256(data);
67 assert_eq!(hash, hash2);
68 }
69
70 #[test]
71 fn test_uuid_types() {
72 let vertex_id = VertexId::new_v4();
74 let edge_id = EdgeId::new_v4();
75
76 assert_ne!(vertex_id, edge_id); assert_eq!(vertex_id.get_version_num(), 4); assert_eq!(edge_id.get_version_num(), 4);
79 }
80}