()
| 438 | fn encode_forward_branch_resolves() { |
| 439 | let tokens = text_section_tokens_with_forward_branch(); |
| 440 | let layout = compute_layout(&tokens).unwrap(); |
| 441 | let output = encode(&tokens, &layout).unwrap(); |
| 442 | |
| 443 | assert_eq!(output.symbol_address("end").unwrap(), 12); |
| 444 | let text = output.text_bytes(); |
| 445 | let word = u32::from_le_bytes(text[4..8].try_into().unwrap()); |
| 446 | assert_eq!(word & 0x7F, 0x63, "wrong opcode for branch"); |
| 447 | assert_eq!((word >> 12) & 0x7, 1, "wrong funct3, expected BNE"); |
| 448 | } |
| 449 | |
| 450 | #[test] |
| 451 | fn encode_backward_branch_resolves() { |
| 452 | let tokens = vec![ |
| 453 | AsmToken::Section(SectionKind::Text), |
nothing calls this directly
no test coverage detected