MCPcopy Create free account
hub / github.com/daniel-e/rustml / test_set

Function test_set

src/matrix.rs:1088–1100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1086
1087 #[test]
1088 fn test_set() {
1089
1090 let mut m = mat![1.0, 2.0; 3.0, 4.0; 5.0, 6.0];
1091 assert_eq!(m.row(0).unwrap(), [1.0, 2.0]);
1092 assert_eq!(m.row(1).unwrap(), [3.0, 4.0]);
1093 assert_eq!(m.row(2).unwrap(), [5.0, 6.0]);
1094 m.set(0, 0, 7.0);
1095 m.set(2, 1, 9.0);
1096 assert_eq!(*m.get(0, 0).unwrap(), 7.0);
1097 assert_eq!(m.row(0).unwrap(), [7.0, 2.0]);
1098 assert_eq!(*m.get(2, 1).unwrap(), 9.0);
1099 assert_eq!(m.row(2).unwrap(), [5.0, 9.0]);
1100 }
1101
1102 #[test]
1103 fn test_row_iter() {

Callers

nothing calls this directly

Calls 1

setMethod · 0.80

Tested by

no test coverage detected