-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fff3fe7
commit 9170e54
Showing
5 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
mod utils; | ||
use utils::get_int; | ||
use utils::setup; | ||
|
||
#[test] | ||
fn should_do_trivial_switch() { | ||
let mut vm = setup(); | ||
let last_frame_value = vm | ||
.run("samples.javacore.switches.trivial.SwitchExample") | ||
.unwrap(); | ||
assert_eq!(300, get_int(last_frame_value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package samples.javacore.switches.trivial; | ||
|
||
public class SwitchExample { | ||
|
||
public static void main(String[] args) { | ||
int value = 30; | ||
int result = switched(value); | ||
} | ||
|
||
private static int switched(int value) { | ||
int result; | ||
switch (value) { | ||
case 10: | ||
result = 100; | ||
break; | ||
case 20: | ||
result = 200; | ||
break; | ||
case 30: | ||
result = 300; | ||
break; | ||
default: | ||
result = -1; | ||
break; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
} |
Binary file added
BIN
+511 Bytes
tests/test_data/samples/javacore/switches/trivial/SwitchExample.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters