✨♻️🧪 vanth: Add From impl, make struct public, refactor tests
- Implemented `From<Value>` for `HashedValue` - Made `ReferenceRetrievalTask` struct public - Removed extraneous space in `#[derive]` attribute for `ReferenceValue` - Consolidated integration tests into `tests/integration` directory - Added new `test_derive` function with debug output - Deleted obsolete test files: `main.rs`, `store.rs`, and `test_node.rs`
This commit is contained in:
parent
8b76fcb659
commit
94105daca1
7 changed files with 47 additions and 33 deletions
|
@ -60,6 +60,15 @@ pub struct HashedValue {
|
|||
inner: Value
|
||||
}
|
||||
|
||||
impl From<Value> for HashedValue {
|
||||
fn from(value: Value) -> Self {
|
||||
Self {
|
||||
content_hash: hash(&value),
|
||||
inner: value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Value {
|
||||
ty: Ty,
|
||||
|
@ -127,7 +136,7 @@ impl <T: Clone + Serialize> Reference<T> {
|
|||
}
|
||||
|
||||
#[derive(Component, Clone, Debug, Deserialize, Serialize)]
|
||||
struct ReferenceRetrievalTask {
|
||||
pub struct ReferenceRetrievalTask {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,3 +7,8 @@ use vanth::Vanth;
|
|||
struct Foo {
|
||||
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_derive() {
|
||||
println!("yeet");
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use vanth::{Component, Node, Reference};
|
||||
|
||||
mod derive;
|
||||
mod fs;
|
||||
|
||||
// #[test]
|
||||
// fn test_store() {
|
||||
// #[derive(Clone, Deserialize, Serialize)]
|
||||
|
@ -26,3 +29,31 @@ use vanth::{Component, Node, Reference};
|
|||
|
||||
// node.save("entity_1", entity_components);
|
||||
// }
|
||||
|
||||
// #[test]
|
||||
// fn test_store() {
|
||||
// #[derive(Deserialize, Serialize)]
|
||||
// struct Foo {
|
||||
// a: u32,
|
||||
// b: f32,
|
||||
// }
|
||||
|
||||
// impl Component for Foo {
|
||||
// fn id() -> String {
|
||||
// "foo".into()
|
||||
// }
|
||||
// }
|
||||
|
||||
// let node = Node::in_memory();
|
||||
|
||||
// let entity_id = "entity_1";
|
||||
// let entity_components = (Foo { a: 5, b: 6.0 },);
|
||||
|
||||
// node.save("entity_1", entity_components);
|
||||
// }
|
||||
|
||||
// #[test]
|
||||
// fn test_entity_count_zero() {
|
||||
// let mut node = Node::new();
|
||||
// assert_eq!(node.entity_count(), 0);
|
||||
// }
|
|
@ -1,24 +0,0 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use vanth::{Component, Node};
|
||||
|
||||
// #[test]
|
||||
// fn test_store() {
|
||||
// #[derive(Deserialize, Serialize)]
|
||||
// struct Foo {
|
||||
// a: u32,
|
||||
// b: f32,
|
||||
// }
|
||||
|
||||
// impl Component for Foo {
|
||||
// fn id() -> String {
|
||||
// "foo".into()
|
||||
// }
|
||||
// }
|
||||
|
||||
// let node = Node::in_memory();
|
||||
|
||||
// let entity_id = "entity_1";
|
||||
// let entity_components = (Foo { a: 5, b: 6.0 },);
|
||||
|
||||
// node.save("entity_1", entity_components);
|
||||
// }
|
|
@ -1,7 +0,0 @@
|
|||
use vanth::Node;
|
||||
|
||||
#[test]
|
||||
fn test_entity_count_zero() {
|
||||
let mut node = Node::new();
|
||||
assert_eq!(node.entity_count(), 0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue