MCPcopy Index your code
hub / github.com/ciphermodelabs/ciphercore / test_or

Function test_or

ciphercore-base/src/custom_ops.rs:806–831  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

804
805 #[test]
806 fn test_or() {
807 || -> Result<()> {
808 let c = create_context()?;
809 let g = c.create_graph()?;
810 let i1 = g.input(scalar_type(BIT))?;
811 let i2 = g.input(scalar_type(BIT))?;
812 let o = g.custom_op(CustomOperation::new(Or {}), vec![i1, i2])?;
813 g.set_output_node(o)?;
814 g.finalize()?;
815 c.set_main_graph(g.clone())?;
816 c.finalize()?;
817 let mapped_c = run_instantiation_pass(c)?;
818 for x in vec![0, 1] {
819 for y in vec![0, 1] {
820 let result = random_evaluate(
821 mapped_c.mappings.get_graph(g.clone()),
822 vec![Value::from_scalar(x, BIT)?, Value::from_scalar(y, BIT)?],
823 )?;
824 let result = result.to_u8(BIT)?;
825 assert_eq!(result, ((x != 0) || (y != 0)) as u8);
826 }
827 }
828 Ok(())
829 }()
830 .unwrap();
831 }
832
833 #[derive(Debug, Serialize, Deserialize, Eq, PartialEq, Hash)]
834 struct A {}

Callers

nothing calls this directly

Calls 13

run_instantiation_passFunction · 0.85
random_evaluateFunction · 0.85
cloneMethod · 0.80
to_u8Method · 0.80
create_contextFunction · 0.70
scalar_typeFunction · 0.70
create_graphMethod · 0.45
inputMethod · 0.45
custom_opMethod · 0.45
set_output_nodeMethod · 0.45
finalizeMethod · 0.45
set_main_graphMethod · 0.45

Tested by

no test coverage detected