mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
comment out tests
This commit is contained in:
@@ -8,7 +8,7 @@ use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||
pub fn setup_network(name: &str) -> (DynamicExecutor, ProtoNetwork) {
|
||||
let mut network = load_from_name(name);
|
||||
let proto_network = network.flatten().unwrap().0;
|
||||
let executor = block_on(DynamicExecutor::new(proto_network.0)).unwrap();
|
||||
let executor = block_on(DynamicExecutor::new(proto_network.clone())).unwrap();
|
||||
(executor, proto_network)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ fn subsequent_evaluations(c: &mut Criterion) {
|
||||
bench_for_each_demo(&mut group, |name, g| {
|
||||
let (executor, _) = setup_network(name);
|
||||
g.bench_function(name, |b| {
|
||||
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context.clone()))).unwrap())
|
||||
b.iter(|| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output().unwrap(), criterion::black_box(context.clone()))).unwrap())
|
||||
});
|
||||
});
|
||||
group.finish();
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use criterion::measurement::Measurement;
|
||||
use criterion::{BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main};
|
||||
use graph_craft::graphene_compiler::Executor;
|
||||
use graph_craft::proto::ProtoNetwork;
|
||||
use graph_craft::util::{DEMO_ART, compile, load_from_name};
|
||||
use graph_craft::util::{DEMO_ART, load_from_name};
|
||||
use graphene_std::transform::Footprint;
|
||||
use interpreted_executor::dynamic_executor::DynamicExecutor;
|
||||
|
||||
@@ -34,9 +33,9 @@ fn run_once<M: Measurement>(name: &str, c: &mut BenchmarkGroup<M>) {
|
||||
let proto_network = network.flatten().unwrap().0;
|
||||
|
||||
let executor = futures::executor::block_on(DynamicExecutor::new(proto_network)).unwrap();
|
||||
let footprint = Footprint::default();
|
||||
let context = graphene_std::any::EditorContext::default();
|
||||
|
||||
c.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).execute(footprint))));
|
||||
c.bench_function(name, |b| b.iter(|| futures::executor::block_on((&executor).evaluate_from_node(context.clone(), None))));
|
||||
}
|
||||
fn run_once_demo(c: &mut Criterion) {
|
||||
let mut g = c.benchmark_group("Run Once no render");
|
||||
|
||||
@@ -11,7 +11,7 @@ fn run_once(c: &mut Criterion) {
|
||||
g.bench_function(name, |b| {
|
||||
b.iter_batched(
|
||||
|| setup_network(name),
|
||||
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output(), criterion::black_box(context.clone()))).unwrap(),
|
||||
|(executor, _)| futures::executor::block_on(executor.tree().eval_tagged_value(executor.output().unwrap(), criterion::black_box(context.clone()))).unwrap(),
|
||||
criterion::BatchSize::SmallInput,
|
||||
)
|
||||
});
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
use crate::node_registry::{CACHE_NODES, NODE_REGISTRY};
|
||||
use dyn_any::StaticType;
|
||||
use graph_craft::document::ProtonodeEntry;
|
||||
use graph_craft::document::value::{TaggedValue, UpcastNode};
|
||||
use graph_craft::proto::{ConstructionArgs, GraphError, LocalFuture, NodeContainer, ProtoNetwork, ProtoNode, SharedNodeContainer, TypeErasedBox, TypingContext, UpstreamInputMetadata};
|
||||
use graph_craft::proto::{GraphErrorType, GraphErrors};
|
||||
use graph_craft::{Type, concrete};
|
||||
use graphene_std::Context;
|
||||
use graphene_std::any::{EditorContext, EditorContextToContext, NullificationNode};
|
||||
use graphene_std::memo::IntrospectMode;
|
||||
use graphene_std::uuid::{CompiledProtonodeInput, NodeId, SNI};
|
||||
use graphene_std::{Context, MemoHash};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::error::Error;
|
||||
use std::ptr::null;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// An executor of a node graph that does not require an online compilation server, and instead uses `Box<dyn ...>`.
|
||||
@@ -365,13 +363,6 @@ impl BorrowTree {
|
||||
// Move the value into the upcast node instead of cloning it
|
||||
match proto_node.construction_args {
|
||||
ConstructionArgs::Value(value_args) => {
|
||||
// The constructor for nodes with value construction args (value nodes) is not called.
|
||||
// let node = if let TaggedValue::ApplicationIo(api) = &*value {
|
||||
// let editor_api = UpcastAsRefNode::new(api.clone());
|
||||
// let node = Box::new(editor_api) as TypeErasedBox<'_>;
|
||||
// NodeContainer::new(node)
|
||||
// } else {
|
||||
|
||||
let upcasted = UpcastNode::new(value_args.value);
|
||||
let node = Box::new(upcasted) as TypeErasedBox<'_>;
|
||||
let value_node = NodeContainer::new(node);
|
||||
@@ -477,17 +468,23 @@ impl BorrowTree {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::{document::value::TaggedValue, proto::NodeValueArgs};
|
||||
use graphene_std::uuid::NodeId;
|
||||
|
||||
#[test]
|
||||
fn push_node_sync() {
|
||||
let mut tree = BorrowTree::default();
|
||||
let val_1_protonode = ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2u32).into()), NodeId(0));
|
||||
let val_1_protonode = ProtoNode::value(
|
||||
ConstructionArgs::Value(NodeValueArgs {
|
||||
value: TaggedValue::U32(2u32).into(),
|
||||
connector_paths: Vec::new(),
|
||||
}),
|
||||
NodeId(0),
|
||||
);
|
||||
let context = TypingContext::default();
|
||||
let future = tree.push_node(val_1_protonode, &context);
|
||||
futures::executor::block_on(future).unwrap();
|
||||
let _node = tree.get(NodeId(0)).unwrap();
|
||||
let _node = tree.nodes.get(&NodeId(0)).expect("Node should be added to tree");
|
||||
let result = futures::executor::block_on(tree.eval(NodeId(0), ()));
|
||||
assert_eq!(result, Some(2u32));
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@ pub mod util;
|
||||
mod tests {
|
||||
use futures::executor::block_on;
|
||||
use graphene_core::*;
|
||||
use graphene_std::uuid::NodeId;
|
||||
|
||||
#[test]
|
||||
fn double_number() {
|
||||
use graph_craft::document::*;
|
||||
use graph_craft::*;
|
||||
|
||||
let network = NodeNetwork {
|
||||
let mut network = NodeNetwork {
|
||||
exports: vec![NodeInput::node(NodeId(1), 0)],
|
||||
nodes: [
|
||||
// Simple identity node taking a number as input from outside the graph
|
||||
@@ -40,9 +41,7 @@ mod tests {
|
||||
};
|
||||
|
||||
use crate::dynamic_executor::DynamicExecutor;
|
||||
use graph_craft::graphene_compiler::Compiler;
|
||||
|
||||
let compiler = Compiler {};
|
||||
let protonetwork = network.flatten().map(|result| result.0).expect("Graph should be generated");
|
||||
|
||||
let _exec = block_on(DynamicExecutor::new(protonetwork)).map(|_e| panic!("The network should not type check ")).unwrap_err();
|
||||
|
||||
@@ -24,7 +24,6 @@ use std::collections::HashMap;
|
||||
#[cfg(feature = "gpu")]
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "gpu")]
|
||||
use wgpu_executor::WgpuExecutor;
|
||||
use wgpu_executor::{WgpuSurface, WindowHandle};
|
||||
|
||||
// TODO: turn into hashmap
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use graph_craft::ProtoNodeIdentifier;
|
||||
use graph_craft::concrete;
|
||||
use graph_craft::document::value::EditorMetadata;
|
||||
use graph_craft::document::value::RenderOutput;
|
||||
use graph_craft::document::value::TaggedValue;
|
||||
use graph_craft::document::{DocumentNode, DocumentNodeImplementation, NodeInput, NodeNetwork};
|
||||
use graph_craft::generic;
|
||||
|
||||
Reference in New Issue
Block a user