MCPcopy Index your code
hub / github.com/endbasic/endbasic / check_errors_two_xy

Function check_errors_two_xy

std/src/gfx/mod.rs:1170–1199  ·  view source on GitHub ↗

Verifies error conditions for a command named `name` that takes two X/Y pairs.

(name: &'static str)

Source from the content-addressed store, hash-verified

1168
1169 /// Verifies error conditions for a command named `name` that takes two X/Y pairs.
1170 fn check_errors_two_xy(name: &'static str) {
1171 for args in &["1, 2, , 4", "1, 2, 3", "1, 2, 3, 4, 5", "2; 3, 4"] {
1172 check_stmt_compilation_err(
1173 format!("1:1: {} expected x1%, y1%, x2%, y2%", name),
1174 &format!("{} {}", name, args),
1175 );
1176 }
1177
1178 for args in &["-40000, 1, 1, 1", "1, -40000, 1, 1", "1, 1, -40000, 1", "1, 1, 1, -40000"] {
1179 let pos = name.len() + 1 + args.find('-').unwrap() + 1;
1180 check_stmt_err(
1181 format!("1:{}: Coordinate -40000 out of range", pos),
1182 &format!("{} {}", name, args),
1183 );
1184 }
1185
1186 for args in &["40000, 1, 1, 1", "1, 40000, 1, 1", "1, 1, 40000, 1", "1, 1, 1, 40000"] {
1187 let pos = name.len() + 1 + args.find('4').unwrap() + 1;
1188 check_stmt_err(
1189 format!("1:{}: Coordinate 40000 out of range", pos),
1190 &format!("{} {}", name, args),
1191 );
1192 }
1193
1194 for args in &["\"a\", 1, 1, 1", "1, \"a\", 1, 1", "1, 1, \"a\", 1", "1, 1, 1, \"a\""] {
1195 let stmt = &format!("{} {}", name, args);
1196 let pos = stmt.find('"').unwrap() + 1;
1197 check_stmt_compilation_err(format!("1:{}: STRING is not a number", pos), stmt);
1198 }
1199 }
1200
1201 /// Verifies error conditions for a command named `name` that takes three X/Y pairs.
1202 fn check_errors_three_xy(name: &'static str) {

Callers 3

test_gfx_line_errorsFunction · 0.85
test_gfx_rect_errorsFunction · 0.85
test_gfx_rectf_errorsFunction · 0.85

Calls 4

check_stmt_errFunction · 0.85
findMethod · 0.80
lenMethod · 0.45

Tested by 3

test_gfx_line_errorsFunction · 0.68
test_gfx_rect_errorsFunction · 0.68
test_gfx_rectf_errorsFunction · 0.68