Skip to content

Commit 45bf47a

Browse files
committed
Reinstate previously failing test for nested components inside groups
1 parent f65b2f3 commit 45bf47a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

crates/hotfix-dictionary/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ keywords.workspace = true
1212
categories.workspace = true
1313

1414
[features]
15-
default = []
15+
default = ["smartstring"]
1616
fix40 = []
1717
fix41 = []
1818
fix42 = []

crates/hotfix-message/src/builder.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -844,17 +844,25 @@ mod tests {
844844
}
845845

846846
#[test]
847-
#[ignore] // TODO: making this test pass requires an overhaul of the message parsing logic
848847
fn test_parsing_nested_component_inside_group() {
849848
// an `AllocationInstruction` with `CommissionData` nested inside `AllocGrp`
850-
let raw = b"8=FIX.4.4|9=252|35=J|49=SELLSIDE|56=BUYSIDE|34=100|52=20251023-14:30:00|70=ALLOC001|71=0|626=1|854=0|55=AAPL|107=Apple Inc|167=CS|54=1|53=10000|60=20251023|75=20251023|381=250000|78=2|79=ACC001|661=1|80=5000|12=100|13=3|11=5|79=ACC002|661=1|80=5000|12=75|13=2|11=3.75|10=031|";
849+
let raw_instrument = "55=AAPL|107=Apple Inc|167=CS";
850+
let raw_alloc_group =
851+
"78=2|79=ACC001|661=1|80=5000|12=100|13=3|79=ACC002|661=1|80=5000|12=75|13=2";
852+
let raw = format!(
853+
"8=FIX.4.4|9=222|35=J|49=SELLSIDE|56=BUYSIDE|34=100|52=20251023-14:30:00|70=ALLOC001|71=0|626=1|857=0|54=1|{raw_instrument}|53=10000|6=125|75=20251023|{raw_alloc_group}|10=068|"
854+
);
851855
let builder = MessageBuilder::new(Dictionary::fix44(), CONFIG).unwrap();
852-
let message = builder.build(raw).into_message().unwrap();
856+
let message = builder.build(raw.as_bytes()).into_message().unwrap();
853857

854858
let alloc_1 = message.get_group(fix44::NO_ALLOCS, 0).unwrap();
855-
assert_eq!(alloc_1.get::<&str>(fix44::ALLOC_ID).unwrap(), "ALLOC001");
859+
assert_eq!(alloc_1.get::<&str>(fix44::ALLOC_ACCOUNT).unwrap(), "ACC001");
860+
assert_eq!(alloc_1.get::<f64>(fix44::COMMISSION).unwrap(), 100.0);
861+
assert_eq!(alloc_1.get::<&str>(fix44::COMM_TYPE).unwrap(), "3");
856862

857863
let alloc_2 = message.get_group(fix44::NO_ALLOCS, 1).unwrap();
858-
assert_eq!(alloc_2.get::<&str>(fix44::ALLOC_ID).unwrap(), "ALLOC002");
864+
assert_eq!(alloc_2.get::<&str>(fix44::ALLOC_ACCOUNT).unwrap(), "ACC002");
865+
assert_eq!(alloc_2.get::<f64>(fix44::COMMISSION).unwrap(), 75.0);
866+
assert_eq!(alloc_2.get::<&str>(fix44::COMM_TYPE).unwrap(), "2");
859867
}
860868
}

0 commit comments

Comments
 (0)