-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstrings.rs
57 lines (50 loc) · 1.84 KB
/
strings.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use std::process::Command;
#[test]
fn int_to_string() {
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("i9;=w")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() == 0, "stderr shouldn't exist");
assert_eq!(String::from_utf8_lossy(&output.stdout), "9");
}
#[test]
fn string_to_int() {
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("i9;==w")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() == 0, "stderr shouldn't exist");
assert_eq!(String::from_utf8_lossy(&output.stdout), "9");
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("iHi;=")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() > 0, "stderr should exist");
}
#[test]
fn string_length() {
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("istring;@W")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() == 0, "stderr shouldn't exist");
assert_eq!(String::from_utf8_lossy(&output.stdout), "6");
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("i;@W")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() == 0, "stderr shouldn't exist");
assert_eq!(String::from_utf8_lossy(&output.stdout), "0");
let output = Command::new("./target/debug/vl")
.arg("-s")
.arg("i99;@W")
.output()
.unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
assert!(output.stderr.len() > 0, "stderr should exist");
}