mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Convert u64 IDs to newtypes (#1532)
This commit is contained in:
parent
7bfe0ce55b
commit
34f952bad1
38 changed files with 565 additions and 446 deletions
|
@ -193,10 +193,10 @@ mod test {
|
|||
let mut tree = BorrowTree::default();
|
||||
let val_1_protonode = ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2u32)), vec![]);
|
||||
let context = TypingContext::default();
|
||||
let future = tree.push_node(0, val_1_protonode, &context); //.await.unwrap();
|
||||
let future = tree.push_node(NodeId(0), val_1_protonode, &context); //.await.unwrap();
|
||||
futures::executor::block_on(future).unwrap();
|
||||
let _node = tree.get(0).unwrap();
|
||||
let result = futures::executor::block_on(tree.eval(0, ()));
|
||||
let _node = tree.get(NodeId(0)).unwrap();
|
||||
let result = futures::executor::block_on(tree.eval(NodeId(0), ()));
|
||||
assert_eq!(result, Some(2u32));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ mod tests {
|
|||
|
||||
fn add_network() -> NodeNetwork {
|
||||
NodeNetwork {
|
||||
inputs: vec![0, 0],
|
||||
outputs: vec![NodeOutput::new(1, 0)],
|
||||
inputs: vec![NodeId(0), NodeId(0)],
|
||||
outputs: vec![NodeOutput::new(NodeId(1), 0)],
|
||||
nodes: [
|
||||
(
|
||||
0,
|
||||
NodeId(0),
|
||||
DocumentNode {
|
||||
name: "Cons".into(),
|
||||
inputs: vec![NodeInput::Network(concrete!(u32)), NodeInput::Network(concrete!(&u32))],
|
||||
|
@ -29,10 +29,10 @@ mod tests {
|
|||
},
|
||||
),
|
||||
(
|
||||
1,
|
||||
NodeId(1),
|
||||
DocumentNode {
|
||||
name: "Add".into(),
|
||||
inputs: vec![NodeInput::node(0, 0)],
|
||||
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
||||
implementation: DocumentNodeImplementation::Unresolved(ProtoNodeIdentifier::new("graphene_core::ops::AddPairNode")),
|
||||
..Default::default()
|
||||
},
|
||||
|
@ -45,10 +45,10 @@ mod tests {
|
|||
}
|
||||
|
||||
let network = NodeNetwork {
|
||||
inputs: vec![0],
|
||||
outputs: vec![NodeOutput::new(0, 0)],
|
||||
inputs: vec![NodeId(0)],
|
||||
outputs: vec![NodeOutput::new(NodeId(0), 0)],
|
||||
nodes: [(
|
||||
0,
|
||||
NodeId(0),
|
||||
DocumentNode {
|
||||
name: "Inc".into(),
|
||||
inputs: vec![
|
||||
|
@ -86,12 +86,12 @@ mod tests {
|
|||
use graph_craft::*;
|
||||
|
||||
let network = NodeNetwork {
|
||||
inputs: vec![0],
|
||||
outputs: vec![NodeOutput::new(1, 0)],
|
||||
inputs: vec![NodeId(0)],
|
||||
outputs: vec![NodeOutput::new(NodeId(1), 0)],
|
||||
nodes: [
|
||||
// Simple identity node taking a number as input from outside the graph
|
||||
(
|
||||
0,
|
||||
NodeId(0),
|
||||
DocumentNode {
|
||||
name: "id".into(),
|
||||
inputs: vec![NodeInput::Network(concrete!(u32))],
|
||||
|
@ -101,10 +101,10 @@ mod tests {
|
|||
),
|
||||
// An add node adding the result of the id node to its self
|
||||
(
|
||||
1,
|
||||
NodeId(1),
|
||||
DocumentNode {
|
||||
name: "Add".into(),
|
||||
inputs: vec![NodeInput::node(0, 0), NodeInput::node(0, 0)],
|
||||
inputs: vec![NodeInput::node(NodeId(0), 0), NodeInput::node(NodeId(0), 0)],
|
||||
implementation: DocumentNodeImplementation::Unresolved(ProtoNodeIdentifier::new("graphene_core::ops::AddNode<_>")),
|
||||
..Default::default()
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue