File size: 937 Bytes
463f868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
use crate::core::logic::*;

#[test]
fn test_opcode_meta_rule() {
    let mut state = GameState::default();
    let db = CardDatabase {
        members: std::collections::HashMap::new(),
        lives: std::collections::HashMap::new(),
        ..CardDatabase::default()
    };
    let ctx = AbilityContext {
        player_id: 0,
        ..AbilityContext::default()
    };

    // O_META_RULE (29), Value 0 (cheer_mod), Attr 0, Target 0
    let bytecode = vec![O_META_RULE, 0, 0, 0, O_RETURN, 0, 0, 0];

    // Capture state before
    let initial_flags = state.players[0].flags;
    let initial_restrictions = state.players[0].restrictions.clone();

    // Execute
    state.resolve_bytecode_cref(&db, &bytecode, &ctx);

    // Verify it did NOTHING (as per current implementation)
    assert_eq!(state.players[0].flags, initial_flags);
    assert_eq!(state.players[0].restrictions, initial_restrictions);
}