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

Function test_relationship_pattern_parser

src/cosql/pattern/relationship.rs:161–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159
160 #[test]
161 fn test_relationship_pattern_parser() {
162 let values = [
163 (
164 "(
165 $person1,
166 $company1
167 ) forms works_in (
168 since: 2-10-1999
169 )",
170 RelationshipPattern {
171 variable: None,
172 roles: vec![
173 Role {
174 role: None,
175 entity: "person1".to_string(),
176 },
177 Role {
178 role: None,
179 entity: "company1".to_string(),
180 },
181 ],
182 relationship_type: "works_in".to_string(),
183 attributes: vec![Attribute {
184 name: "since".to_string(),
185 value: Value::Date(Date(2, 10, 1999)),
186 }],
187 },
188 ),
189 (
190 "$relation1 (
191 from: $city1,
192 to: $city2
193 ) forms reachable (
194 distance: $dist
195 )",
196 RelationshipPattern {
197 variable: Some("relation1".to_string()),
198 roles: vec![
199 Role {
200 role: Some("from".to_string()),
201 entity: "city1".to_string(),
202 },
203 Role {
204 role: Some("to".to_string()),
205 entity: "city2".to_string(),
206 },
207 ],
208 relationship_type: "reachable".to_string(),
209 attributes: vec![Attribute {
210 name: "distance".to_string(),
211 value: Value::Variable("dist".to_string()),
212 }],
213 },
214 ),
215 ];
216
217 for (source, expected) in values {
218 let (_, parsed) = parse_relationship_pattern(source).unwrap();

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected