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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Reference witness: the richer OCEL 2.0 surface is CONSTRUCTED and queried
// (COVERAGE.md ยง2.2 โ advances the OCEL-2.0 row from ๐ด to ๐ข).
//
// Beyond the `OcelLog` admission shape, wasm4pm-compat exports the full OCEL 2.0
// object model: `OCEL` (log), `OCELEvent`, `OCELObject`, `OCELRelationship`.
// This builds a real OCEL 2.0 log and exercises its query surface โ the
// positive (admit) side of the type, complementing the refusal witnesses.
//
// Failing-when-fake: remove wasm4pm-compat โ no compile; if the query methods
// returned constants, the counts below would not reflect the constructed log.
use wasm4pm_compat::ocel::{OCELEvent, OCELObject, OCEL};
#[test]
fn ocel2_log_is_constructed_and_queryable() {
// Two events, three objects across two object types.
let events = vec![
OCELEvent::new("e1".to_string(), "create"),
OCELEvent::new("e2".to_string(), "release"),
];
let objects = vec![
OCELObject::new("o1".to_string(), "artifact"),
OCELObject::new("o2".to_string(), "artifact"),
OCELObject::new("agent-1".to_string(), "agent"),
];
let log = OCEL::new(events, objects);
// The query surface reflects the constructed log (not constants).
assert_eq!(log.event_set().len(), 2, "two events constructed");
assert_eq!(log.object_set().len(), 3, "three objects constructed");
assert_eq!(
log.count_objects_of_type("artifact"),
2,
"two artifact-typed objects"
);
assert_eq!(
log.count_objects_of_type("agent"),
1,
"one agent-typed object"
);
assert_eq!(
log.count_objects_of_type("nonexistent"),
0,
"an undeclared object type has zero objects"
);
}
#[test]
fn ocel2_event_and_object_carry_their_identity() {
let e = OCELEvent::new("e1".to_string(), "create");
let o = OCELObject::new("o1".to_string(), "artifact");
// Constructed values carry the identity they were built with.
assert_eq!(e.id, "e1");
assert_eq!(e.event_type, "create");
assert_eq!(o.id, "o1");
assert_eq!(o.object_type, "artifact");
}