MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_entity_insertion_parser

Function test_entity_insertion_parser

src/cosql/insertion/entity.rs:39–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38 #[test]
39 fn test_entity_insertion_parser() {
40 let values = [
41 (
42 r#"$rust_dev isa person (
43 name: "The Rust Dev",
44 age: 54,
45 date_of_birth: 01-01-1970
46 );"#,
47 EntityInsertion {
48 variable: "rust_dev".to_string(),
49 entity_type: "person".to_string(),
50 attributes: vec![
51 Attribute {
52 name: "name".to_string(),
53 value: Value::String("The Rust Dev".to_string()),
54 },
55 Attribute {
56 name: "age".to_string(),
57 value: Value::Int(54),
58 },
59 Attribute {
60 name: "date_of_birth".to_string(),
61 value: Value::Date(Date(1, 1, 1970)),
62 },
63 ],
64 },
65 ),
66 (
67 r#"$rust_project isa project (
68 name: "A Rust Project",
69 start_date: 01-01-2000,
70 end_date: 31-12-2009
71 );"#,
72 EntityInsertion {
73 variable: "rust_project".to_string(),
74 entity_type: "project".to_string(),
75 attributes: vec![
76 Attribute {
77 name: "name".to_string(),
78 value: Value::String("A Rust Project".to_string()),
79 },
80 Attribute {
81 name: "start_date".to_string(),
82 value: Value::Date(Date(1, 1, 2000)),
83 },
84 Attribute {
85 name: "end_date".to_string(),
86 value: Value::Date(Date(31, 12, 2009)),
87 },
88 ],
89 },
90 ),
91 ];
92
93 for (source, expected) in values {
94 let (_, parsed) = parse_entity_insertion(source).unwrap();
95
96 assert_eq!(parsed, expected);

Callers

nothing calls this directly

Calls 1

parse_entity_insertionFunction · 0.85

Tested by

no test coverage detected