File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ extern crate libcc2rs;
2+ use libcc2rs:: * ;
3+ use std:: cell:: RefCell ;
4+ use std:: collections:: BTreeMap ;
5+ use std:: io:: prelude:: * ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: AsFd ;
8+ use std:: rc:: { Rc , Weak } ;
9+ pub fn case_then_default_0 ( x : i32 ) -> i32 {
10+ let x: Value < i32 > = Rc :: new ( RefCell :: new ( x) ) ;
11+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
12+ ' switch: {
13+ let __match_cond = ( * x. borrow ( ) ) ;
14+ match __match_cond {
15+ v if v == 2 => {
16+ ( * r. borrow_mut ( ) ) = 20 ;
17+ break ' switch;
18+ }
19+ _ => {
20+ ( * r. borrow_mut ( ) ) = 10 ;
21+ break ' switch;
22+ }
23+ }
24+ } ;
25+ return ( * r. borrow ( ) ) ;
26+ }
27+ pub fn main ( ) {
28+ std:: process:: exit ( main_0 ( ) ) ;
29+ }
30+ fn main_0 ( ) -> i32 {
31+ assert ! (
32+ ( ( {
33+ let _x: i32 = 1 ;
34+ case_then_default_0( _x)
35+ } ) == 10 )
36+ ) ;
37+ assert ! (
38+ ( ( {
39+ let _x: i32 = 2 ;
40+ case_then_default_0( _x)
41+ } ) == 20 )
42+ ) ;
43+ assert ! (
44+ ( ( {
45+ let _x: i32 = 99 ;
46+ case_then_default_0( _x)
47+ } ) == 10 )
48+ ) ;
49+ return 0 ;
50+ }
Original file line number Diff line number Diff line change 1+ extern crate libcc2rs;
2+ use libcc2rs:: * ;
3+ use std:: cell:: RefCell ;
4+ use std:: collections:: BTreeMap ;
5+ use std:: io:: prelude:: * ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: AsFd ;
8+ use std:: rc:: { Rc , Weak } ;
9+ pub fn cases_and_default_stacked_0 ( x : i32 ) -> i32 {
10+ let x: Value < i32 > = Rc :: new ( RefCell :: new ( x) ) ;
11+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
12+ ' switch: {
13+ let __match_cond = ( * x. borrow ( ) ) ;
14+ match __match_cond {
15+ v if v == 3 => {
16+ ( * r. borrow_mut ( ) ) = 3 ;
17+ break ' switch;
18+ }
19+ _ => {
20+ ( * r. borrow_mut ( ) ) = 42 ;
21+ break ' switch;
22+ }
23+ }
24+ } ;
25+ return ( * r. borrow ( ) ) ;
26+ }
27+ pub fn main ( ) {
28+ std:: process:: exit ( main_0 ( ) ) ;
29+ }
30+ fn main_0 ( ) -> i32 {
31+ assert ! (
32+ ( ( {
33+ let _x: i32 = 1 ;
34+ cases_and_default_stacked_0( _x)
35+ } ) == 42 )
36+ ) ;
37+ assert ! (
38+ ( ( {
39+ let _x: i32 = 2 ;
40+ cases_and_default_stacked_0( _x)
41+ } ) == 42 )
42+ ) ;
43+ assert ! (
44+ ( ( {
45+ let _x: i32 = 3 ;
46+ cases_and_default_stacked_0( _x)
47+ } ) == 3 )
48+ ) ;
49+ assert ! (
50+ ( ( {
51+ let _x: i32 = 99 ;
52+ cases_and_default_stacked_0( _x)
53+ } ) == 42 )
54+ ) ;
55+ return 0 ;
56+ }
Original file line number Diff line number Diff line change 1+ extern crate libcc2rs;
2+ use libcc2rs:: * ;
3+ use std:: cell:: RefCell ;
4+ use std:: collections:: BTreeMap ;
5+ use std:: io:: prelude:: * ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: AsFd ;
8+ use std:: rc:: { Rc , Weak } ;
9+ pub fn default_then_case_0 ( x : i32 ) -> i32 {
10+ let x: Value < i32 > = Rc :: new ( RefCell :: new ( x) ) ;
11+ let r: Value < i32 > = Rc :: new ( RefCell :: new ( 0 ) ) ;
12+ ' switch: {
13+ let __match_cond = ( * x. borrow ( ) ) ;
14+ match __match_cond {
15+ v if v == 1 => {
16+ ( * r. borrow_mut ( ) ) = 1 ;
17+ break ' switch;
18+ }
19+ v if v == 3 => {
20+ ( * r. borrow_mut ( ) ) = 3 ;
21+ break ' switch;
22+ }
23+ _ => {
24+ ( * r. borrow_mut ( ) ) = 77 ;
25+ break ' switch;
26+ }
27+ }
28+ } ;
29+ return ( * r. borrow ( ) ) ;
30+ }
31+ pub fn main ( ) {
32+ std:: process:: exit ( main_0 ( ) ) ;
33+ }
34+ fn main_0 ( ) -> i32 {
35+ assert ! (
36+ ( ( {
37+ let _x: i32 = 1 ;
38+ default_then_case_0( _x)
39+ } ) == 1 )
40+ ) ;
41+ assert ! (
42+ ( ( {
43+ let _x: i32 = 2 ;
44+ default_then_case_0( _x)
45+ } ) == 77 )
46+ ) ;
47+ assert ! (
48+ ( ( {
49+ let _x: i32 = 3 ;
50+ default_then_case_0( _x)
51+ } ) == 3 )
52+ ) ;
53+ assert ! (
54+ ( ( {
55+ let _x: i32 = 99 ;
56+ default_then_case_0( _x)
57+ } ) == 77 )
58+ ) ;
59+ return 0 ;
60+ }
Original file line number Diff line number Diff line change 1+ extern crate libc;
2+ use libc:: * ;
3+ extern crate libcc2rs;
4+ use libcc2rs:: * ;
5+ use std:: collections:: BTreeMap ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
8+ use std:: rc:: Rc ;
9+ pub unsafe fn case_then_default_0 ( mut x : i32 ) -> i32 {
10+ let mut r: i32 = 0 ;
11+ ' switch: {
12+ let __match_cond = x;
13+ match __match_cond {
14+ v if v == 2 => {
15+ r = 20 ;
16+ break ' switch;
17+ }
18+ _ => {
19+ r = 10 ;
20+ break ' switch;
21+ }
22+ }
23+ } ;
24+ return r;
25+ }
26+ pub fn main ( ) {
27+ unsafe {
28+ std:: process:: exit ( main_0 ( ) as i32 ) ;
29+ }
30+ }
31+ unsafe fn main_0 ( ) -> i32 {
32+ assert ! (
33+ ( ( unsafe {
34+ let _x: i32 = 1 ;
35+ case_then_default_0( _x)
36+ } ) == ( 10 ) )
37+ ) ;
38+ assert ! (
39+ ( ( unsafe {
40+ let _x: i32 = 2 ;
41+ case_then_default_0( _x)
42+ } ) == ( 20 ) )
43+ ) ;
44+ assert ! (
45+ ( ( unsafe {
46+ let _x: i32 = 99 ;
47+ case_then_default_0( _x)
48+ } ) == ( 10 ) )
49+ ) ;
50+ return 0 ;
51+ }
Original file line number Diff line number Diff line change 1+ extern crate libc;
2+ use libc:: * ;
3+ extern crate libcc2rs;
4+ use libcc2rs:: * ;
5+ use std:: collections:: BTreeMap ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
8+ use std:: rc:: Rc ;
9+ pub unsafe fn cases_and_default_stacked_0 ( mut x : i32 ) -> i32 {
10+ let mut r: i32 = 0 ;
11+ ' switch: {
12+ let __match_cond = x;
13+ match __match_cond {
14+ v if v == 3 => {
15+ r = 3 ;
16+ break ' switch;
17+ }
18+ _ => {
19+ r = 42 ;
20+ break ' switch;
21+ }
22+ }
23+ } ;
24+ return r;
25+ }
26+ pub fn main ( ) {
27+ unsafe {
28+ std:: process:: exit ( main_0 ( ) as i32 ) ;
29+ }
30+ }
31+ unsafe fn main_0 ( ) -> i32 {
32+ assert ! (
33+ ( ( unsafe {
34+ let _x: i32 = 1 ;
35+ cases_and_default_stacked_0( _x)
36+ } ) == ( 42 ) )
37+ ) ;
38+ assert ! (
39+ ( ( unsafe {
40+ let _x: i32 = 2 ;
41+ cases_and_default_stacked_0( _x)
42+ } ) == ( 42 ) )
43+ ) ;
44+ assert ! (
45+ ( ( unsafe {
46+ let _x: i32 = 3 ;
47+ cases_and_default_stacked_0( _x)
48+ } ) == ( 3 ) )
49+ ) ;
50+ assert ! (
51+ ( ( unsafe {
52+ let _x: i32 = 99 ;
53+ cases_and_default_stacked_0( _x)
54+ } ) == ( 42 ) )
55+ ) ;
56+ return 0 ;
57+ }
Original file line number Diff line number Diff line change 1+ extern crate libc;
2+ use libc:: * ;
3+ extern crate libcc2rs;
4+ use libcc2rs:: * ;
5+ use std:: collections:: BTreeMap ;
6+ use std:: io:: { Read , Seek , Write } ;
7+ use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
8+ use std:: rc:: Rc ;
9+ pub unsafe fn default_then_case_0 ( mut x : i32 ) -> i32 {
10+ let mut r: i32 = 0 ;
11+ ' switch: {
12+ let __match_cond = x;
13+ match __match_cond {
14+ v if v == 1 => {
15+ r = 1 ;
16+ break ' switch;
17+ }
18+ v if v == 3 => {
19+ r = 3 ;
20+ break ' switch;
21+ }
22+ _ => {
23+ r = 77 ;
24+ break ' switch;
25+ }
26+ }
27+ } ;
28+ return r;
29+ }
30+ pub fn main ( ) {
31+ unsafe {
32+ std:: process:: exit ( main_0 ( ) as i32 ) ;
33+ }
34+ }
35+ unsafe fn main_0 ( ) -> i32 {
36+ assert ! (
37+ ( ( unsafe {
38+ let _x: i32 = 1 ;
39+ default_then_case_0( _x)
40+ } ) == ( 1 ) )
41+ ) ;
42+ assert ! (
43+ ( ( unsafe {
44+ let _x: i32 = 2 ;
45+ default_then_case_0( _x)
46+ } ) == ( 77 ) )
47+ ) ;
48+ assert ! (
49+ ( ( unsafe {
50+ let _x: i32 = 3 ;
51+ default_then_case_0( _x)
52+ } ) == ( 3 ) )
53+ ) ;
54+ assert ! (
55+ ( ( unsafe {
56+ let _x: i32 = 99 ;
57+ default_then_case_0( _x)
58+ } ) == ( 77 ) )
59+ ) ;
60+ return 0 ;
61+ }
You can’t perform that action at this time.
0 commit comments