| 269 | ); |
| 270 | } |
| 271 | |
| 272 | #[test] |
| 273 | fn expr_share_5() { |
| 274 | // Expr::Share(5) -> Tag4 { flag: 0xB, size: 5 } -> 0xB5 |
| 275 | let mut buf = Vec::new(); |
| 276 | serialize::put_expr(&Expr::Share(5), &mut buf); |
| 277 | assert_eq!(buf, vec![0xB5], "Expr::Share(5) should be 0xB5"); |
| 278 | } |
| 279 | |
| 280 | #[test] |
| 281 | fn expr_app_telescope() { |
| 282 | // App(App(App(f, a), b), c) with f=Var(3), a=Var(2), b=Var(1), c=Var(0) |
| 283 | // -> Tag4 { flag: 0x7, size: 3 } + f + a + b + c |
| 284 | // = 0x73 + 0x13 + 0x12 + 0x11 + 0x10 |
| 285 | let expr = Expr::app( |
| 286 | Expr::app(Expr::app(Expr::var(3), Expr::var(2)), Expr::var(1)), |
| 287 | Expr::var(0), |
| 288 | ); |
| 289 | let mut buf = Vec::new(); |