Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'

This commit is contained in:
ruv
2026-02-28 14:39:40 -05:00
7854 changed files with 3522914 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
# Test Fixtures
This directory contains sample datasets and expected results for testing the RuVector graph database.
## Datasets
### movie_database.json
A small movie database inspired by Neo4j's example dataset:
- 3 actors (Keanu Reeves, Carrie-Anne Moss, Laurence Fishburne)
- 1 movie (The Matrix)
- 3 ACTED_IN relationships with role properties
### social_network.json
A simple social network for testing graph algorithms:
- 5 people
- 6 KNOWS relationships forming a small network
## Expected Results
### expected_results.json
Contains test cases with:
- Query text (Cypher)
- Which dataset to use
- Expected query results
Use these to validate that query execution returns correct results.
## Usage in Tests
```rust
use std::fs;
use serde_json::Value;
#[test]
fn test_with_fixture() {
let fixture = fs::read_to_string("tests/fixtures/movie_database.json").unwrap();
let data: Value = serde_json::from_str(&fixture).unwrap();
// Load data into graph
// Execute queries
// Validate against expected results
}
```
## Adding New Fixtures
When adding new fixtures:
1. Follow the JSON schema used in existing files
2. Add corresponding expected results
3. Document the dataset purpose
4. Keep datasets small and focused on specific test scenarios

View File

@@ -0,0 +1,48 @@
{
"description": "Expected query results for validation",
"test_cases": [
{
"name": "count_all_nodes",
"query": "MATCH (n) RETURN COUNT(n)",
"dataset": "movie_database",
"expected": [{"COUNT(n)": 4}]
},
{
"name": "match_person_nodes",
"query": "MATCH (p:Person) RETURN p.name ORDER BY p.name",
"dataset": "movie_database",
"expected": [
{"p.name": "Carrie-Anne Moss"},
{"p.name": "Keanu Reeves"},
{"p.name": "Laurence Fishburne"}
]
},
{
"name": "count_relationships",
"query": "MATCH ()-[r:ACTED_IN]->() RETURN COUNT(r)",
"dataset": "movie_database",
"expected": [{"COUNT(r)": 3}]
},
{
"name": "social_network_friends",
"query": "MATCH (p:Person {name: 'Alice'})-[:KNOWS]->(friend) RETURN friend.name ORDER BY friend.name",
"dataset": "social_network",
"expected": [
{"friend.name": "Bob"},
{"friend.name": "Charlie"}
]
},
{
"name": "average_age",
"query": "MATCH (p:Person) RETURN AVG(p.age) AS avg_age",
"dataset": "social_network",
"expected": [{"avg_age": 30.4}]
},
{
"name": "people_born_after_1965",
"query": "MATCH (p:Person) WHERE p.born > 1965 RETURN p.name",
"dataset": "movie_database",
"expected": [{"p.name": "Carrie-Anne Moss"}]
}
]
}

View File

@@ -0,0 +1,67 @@
{
"description": "Sample movie database for testing",
"nodes": [
{
"id": "keanu",
"labels": ["Person"],
"properties": {
"name": "Keanu Reeves",
"born": 1964
}
},
{
"id": "carrie",
"labels": ["Person"],
"properties": {
"name": "Carrie-Anne Moss",
"born": 1967
}
},
{
"id": "laurence",
"labels": ["Person"],
"properties": {
"name": "Laurence Fishburne",
"born": 1961
}
},
{
"id": "matrix",
"labels": ["Movie"],
"properties": {
"title": "The Matrix",
"released": 1999,
"tagline": "Welcome to the Real World"
}
}
],
"edges": [
{
"id": "e1",
"from": "keanu",
"to": "matrix",
"type": "ACTED_IN",
"properties": {
"roles": ["Neo"]
}
},
{
"id": "e2",
"from": "carrie",
"to": "matrix",
"type": "ACTED_IN",
"properties": {
"roles": ["Trinity"]
}
},
{
"id": "e3",
"from": "laurence",
"to": "matrix",
"type": "ACTED_IN",
"properties": {
"roles": ["Morpheus"]
}
}
]
}

View File

@@ -0,0 +1,18 @@
{
"description": "Sample social network for testing",
"nodes": [
{"id": "alice", "labels": ["Person"], "properties": {"name": "Alice", "age": 30}},
{"id": "bob", "labels": ["Person"], "properties": {"name": "Bob", "age": 35}},
{"id": "charlie", "labels": ["Person"], "properties": {"name": "Charlie", "age": 28}},
{"id": "diana", "labels": ["Person"], "properties": {"name": "Diana", "age": 32}},
{"id": "eve", "labels": ["Person"], "properties": {"name": "Eve", "age": 27}}
],
"edges": [
{"id": "e1", "from": "alice", "to": "bob", "type": "KNOWS", "properties": {"since": 2015}},
{"id": "e2", "from": "alice", "to": "charlie", "type": "KNOWS", "properties": {"since": 2018}},
{"id": "e3", "from": "bob", "to": "charlie", "type": "KNOWS", "properties": {"since": 2016}},
{"id": "e4", "from": "bob", "to": "diana", "type": "KNOWS", "properties": {"since": 2019}},
{"id": "e5", "from": "charlie", "to": "eve", "type": "KNOWS", "properties": {"since": 2020}},
{"id": "e6", "from": "diana", "to": "eve", "type": "KNOWS", "properties": {"since": 2017}}
]
}