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

Function test_ones

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

Source from the content-addressed store, hash-verified

3892
3893 #[test]
3894 fn test_ones() -> Result<()> {
3895 let helper = |t| {
3896 let c = simple_context(|g| g.ones(t))?;
3897 let g = c.get_main_graph()?;
3898 let o = g.get_output_node()?;
3899 value_to_flattened_array_u64(random_evaluate(g, vec![])?, o.get_type()?)
3900 };
3901 assert_eq!(helper(scalar_type(INT32))?, vec![1]);
3902 assert_eq!(helper(array_type(vec![5], INT32))?, vec![1, 1, 1, 1, 1]);
3903 assert_eq!(helper(array_type(vec![3, 2], BIT))?, vec![1, 1, 1, 1, 1, 1]);
3904 assert_eq!(
3905 helper(tuple_type(vec![
3906 scalar_type(BIT),
3907 array_type(vec![2], INT32)
3908 ]))?,
3909 vec![1, 1, 1]
3910 );
3911 Ok(())
3912 }
3913
3914 #[test]
3915 fn test_cum_sum() -> Result<()> {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected