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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
//! Tests for `mod_interface` aggregation functionality (Task 008)
//!
//! These tests verify that `test_tools` aggregates and re-exports testing utilities
//! according to `mod_interface` protocol (FR-2).
#[ cfg(test) ]
mod mod_interface_aggregation_tests
{
/// Test that own namespace properly aggregates constituent crate functionality
#[ test ]
fn test_own_namespace_aggregation()
{
// Test that own namespace includes collection types (no macros to avoid ambiguity)
let _collection_type: test_tools ::own ::BTreeMap< i32, String > = test_tools ::own ::BTreeMap ::new();
let _collection_type2: test_tools ::own ::HashMap< i32, String > = test_tools ::own ::HashMap ::new();
// Test that own namespace includes core testing utilities
let smoke_test = test_tools ::own ::SmokeModuleTest ::new("test");
assert_eq!(smoke_test.dependency_name, "test");
// Verify that these are accessible and not hidden by feature gates
// Own namespace aggregation verified through successful type usage above
}
/// Test that orphan namespace properly aggregates parent functionality
#[ test ]
fn test_orphan_namespace_aggregation()
{
// Test that orphan namespace includes test utilities
let smoke_test = test_tools ::orphan ::SmokeModuleTest ::new("test");
assert_eq!(smoke_test.dependency_name, "test");
// Verify orphan namespace aggregation rules
// Orphan namespace aggregation verified through successful type usage above
}
/// Test that exposed namespace properly aggregates core functionality
#[ test ]
fn test_exposed_namespace_aggregation()
{
// Test that exposed namespace includes collection types and aliases
let _collection_alias: test_tools ::exposed ::Llist< i32 > = test_tools ::exposed ::Llist ::new();
let _collection_alias2: test_tools ::exposed ::Hmap< i32, String > = test_tools ::exposed ::Hmap ::new();
// Test that exposed namespace includes test utilities
let smoke_test = test_tools ::exposed ::SmokeModuleTest ::new("test");
assert_eq!(smoke_test.dependency_name, "test");
// Test that exposed namespace includes collection constructor macros
#[ cfg(feature = "collection_constructors") ]
{
let _heap_collection = test_tools ::exposed ::heap![ 1, 2, 3 ];
let _bmap_collection = test_tools ::exposed ::bmap!{ 1 => "one" };
}
// Exposed namespace aggregation verified through successful type usage above
}
/// Test that prelude namespace includes essential utilities
#[ test ]
fn test_prelude_namespace_aggregation()
{
// Test that prelude exists and is accessible
// The prelude includes essential types and traits from constituent crates
// Prelude namespace verified through successful compilation
}
/// Test re-export visibility from constituent crates
#[ test ]
fn test_reexport_visibility()
{
// Test that collection types are properly re-exported
let _btree_map: test_tools ::BTreeMap< i32, String > = test_tools ::BTreeMap ::new();
let _hash_map: test_tools ::HashMap< i32, String > = test_tools ::HashMap ::new();
// Test that test utilities are properly re-exported
let smoke_test = test_tools ::SmokeModuleTest ::new("test");
assert_eq!(smoke_test.dependency_name, "test");
// Constituent crate visibility verified through successful type usage above
}
/// Test namespace isolation and propagation rules
#[ test ]
fn test_namespace_isolation_and_propagation()
{
// Test that namespaces are properly isolated - own includes orphan, orphan includes exposed, exposed includes prelude
// Verify own namespace includes what orphan provides
let _from_orphan_via_own = test_tools ::own ::SmokeModuleTest ::new("test1");
// Verify orphan namespace includes what exposed provides
let _from_exposed_via_orphan = test_tools ::orphan ::SmokeModuleTest ::new("test2");
// Verify exposed namespace includes what prelude provides
let _from_prelude_via_exposed = test_tools ::exposed ::SmokeModuleTest ::new("test3");
// Test that collection constructor macros follow proper namespace rules
#[ cfg(feature = "collection_constructors") ]
{
// Constructor macros should be available in exposed but isolated from root to prevent ambiguity
let _heap_from_exposed = test_tools ::exposed ::heap![ 1, 2, 3 ];
}
// Namespace isolation and propagation verified through successful type usage above
}
/// Test that aggregation follows `mod_interface` protocol structure
#[ test ]
fn test_mod_interface_protocol_compliance()
{
// Verify that the four standard namespaces exist and are accessible
// own namespace should exist and be accessible
let own_access = core ::any ::type_name :: < fn() -> test_tools ::own ::BTreeMap< i32, i32 >>();
assert!(own_access.contains("BTreeMap"), "own namespace should be accessible");
// orphan namespace should exist and be accessible
let orphan_access = core ::any ::type_name :: < fn() -> test_tools ::orphan ::BTreeMap< i32, i32 >>();
assert!(orphan_access.contains("BTreeMap"), "orphan namespace should be accessible");
// exposed namespace should exist and be accessible
let exposed_access = core ::any ::type_name :: < fn() -> test_tools ::exposed ::BTreeMap< i32, i32 >>();
assert!(exposed_access.contains("BTreeMap"), "exposed namespace should be accessible");
// prelude namespace should exist and be accessible
// We test the module path existence rather than specific types due to trait complexities
// Prelude namespace accessibility verified through successful compilation
}
/// Test that dependencies are properly aggregated through dependency module
#[ test ]
fn test_dependency_module_aggregation()
{
#[ cfg(feature = "enabled") ]
{
// Test that constituent crates are accessible through dependency module
// We verify the module structure exists
#[ cfg(not(all(feature = "standalone_build", not(feature = "normal_build")))) ]
{
let collection_tools_dep = core ::any ::type_name :: < test_tools ::dependency ::collection_tools ::BTreeMap<i32, i32 >>();
assert!(collection_tools_dep.contains("BTreeMap"), "collection_tools should be accessible via dependency module");
}
}
// Dependencies aggregation verified through successful compilation
}
/// Test that aggregation maintains feature compatibility
#[ test ]
fn test_feature_compatibility_in_aggregation()
{
// Test that feature gates work correctly in aggregated environment
#[ cfg(feature = "collection_constructors") ]
{
// Constructor macros should be available when feature is enabled
let heap_collection = test_tools ::exposed ::heap![ 1, 2, 3 ];
assert_eq!(heap_collection.len(), 3, "Collection constructors should work when feature enabled");
}
// Test that basic functionality works regardless of optional features
let basic_collection: test_tools ::BTreeMap< i32, String > = test_tools ::BTreeMap ::new();
assert_eq!(basic_collection.len(), 0, "Basic types should always be available");
// Test that test utilities work regardless of features
let smoke_test = test_tools ::SmokeModuleTest ::new("test");
assert_eq!(smoke_test.dependency_name, "test", "Core test utilities should always work");
}
}