MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / test_zeros

Function test_zeros

ciphercore-base/src/evaluators/simple_evaluator.rs:3873–3891  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3871
3872 #[test]
3873 fn test_zeros() -> Result<()> {
3874 let helper = |t| {
3875 let c = simple_context(|g| g.zeros(t))?;
3876 let g = c.get_main_graph()?;
3877 let o = g.get_output_node()?;
3878 value_to_flattened_array_u64(random_evaluate(g, vec![])?, o.get_type()?)
3879 };
3880 assert_eq!(helper(scalar_type(INT32))?, vec![0]);
3881 assert_eq!(helper(array_type(vec![5], INT32))?, vec![0, 0, 0, 0, 0]);
3882 assert_eq!(helper(array_type(vec![3, 2], BIT))?, vec![0, 0, 0, 0, 0, 0]);
3883 assert_eq!(
3884 helper(tuple_type(vec![
3885 scalar_type(BIT),
3886 array_type(vec![2], INT32)
3887 ]))?,
3888 vec![0, 0, 0]
3889 );
3890 Ok(())
3891 }
3892
3893 #[test]
3894 fn test_ones() -> Result<()> {

Callers

nothing calls this directly

Calls 7

simple_contextFunction · 0.85
random_evaluateFunction · 0.85
zerosMethod · 0.80
get_main_graphMethod · 0.45
get_output_nodeMethod · 0.45
get_typeMethod · 0.45

Tested by

no test coverage detected