Skip to content

Commit 170ad6d

Browse files
committed
Remove emoji in test code
1 parent 114f7c3 commit 170ad6d

4 files changed

Lines changed: 30 additions & 30 deletions

File tree

libCacheSim-python/examples/demo_unified_interface.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def create_demo_lru_hooks():
3838
"""Create demo LRU hooks for Python-based cache policy."""
3939

4040
def init_hook(cache_size):
41-
print(f" 🔧 Initializing custom LRU with {cache_size} bytes")
41+
print(f" Initializing custom LRU with {cache_size} bytes")
4242
return OrderedDict()
4343

4444
def hit_hook(lru_dict, obj_id, obj_size):
@@ -61,7 +61,7 @@ def remove_hook(lru_dict, obj_id):
6161

6262
def demo_unified_interface():
6363
"""Demonstrate the unified interface across different cache policies."""
64-
print("🎯 libCacheSim Python Binding - Unified Interface Demo")
64+
print("libCacheSim Python Binding - Unified Interface Demo")
6565
print("=" * 60)
6666

6767
cache_size = 1024 * 1024 # 1MB
@@ -79,10 +79,10 @@ def demo_unified_interface():
7979
python_cache.set_hooks(init_hook, hit_hook, miss_hook, eviction_hook, remove_hook)
8080
caches["Custom Python LRU"] = python_cache
8181

82-
print(f"📋 Testing {len(caches)} different cache policies with unified interface:")
82+
print(f"Testing {len(caches)} different cache policies with unified interface:")
8383

8484
# Demo 1: Single request interface
85-
print("\n1️⃣ Single Request Interface:")
85+
print("1. Single Request Interface:")
8686
print(" All caches use: cache.get(request)")
8787

8888
test_req = lcs.Request()
@@ -94,15 +94,15 @@ def demo_unified_interface():
9494
print(f" {name:20s}: {'HIT' if result else 'MISS'}")
9595

9696
# Demo 2: Unified properties interface
97-
print("\n2️⃣ Unified Properties Interface:")
97+
print("\n2. Unified Properties Interface:")
9898
print(" All caches provide: cache_size, n_obj, occupied_byte, n_req")
9999

100100
for name, cache in caches.items():
101101
print(f" {name:20s}: size={cache.cache_size}, objs={cache.n_obj}, "
102102
f"bytes={cache.occupied_byte}, reqs={cache.n_req}")
103103

104104
# Demo 3: Efficient trace processing
105-
print("\n3️⃣ Efficient Trace Processing Interface:")
105+
print("\n3. Efficient Trace Processing Interface:")
106106
print(" All caches use: cache.process_trace(reader, max_req=N)")
107107

108108
max_requests = 1000
@@ -117,14 +117,14 @@ def demo_unified_interface():
117117
miss_ratio = cache.process_trace(reader, max_req=max_requests)
118118
print(f" {name:20s}: miss_ratio={miss_ratio:.4f}")
119119

120-
print("\n✨ Key Benefits of Unified Interface:")
120+
print("\nKey Benefits of Unified Interface:")
121121
print(" • Same API for all cache policies (built-in + custom)")
122122
print(" • Easy to switch between different algorithms")
123123
print(" • Efficient trace processing in C++ (no Python overhead)")
124124
print(" • Consistent properties and statistics")
125125
print(" • Type-safe and well-documented")
126126

127-
print("\n🎉 Demo completed! All cache policies work with the same interface.")
127+
print("\nDemo completed! All cache policies work with the same interface.")
128128

129129

130130
if __name__ == "__main__":

libCacheSim-python/tests/test_process_trace.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_process_trace_native():
5151

5252
# Verify miss ratio is reasonable (should be between 0 and 1)
5353
assert 0.0 <= miss_ratio <= 1.0, f"Invalid miss ratio: {miss_ratio}"
54-
print(" Native LRU process_trace test PASSED")
54+
print("PASS: Native LRU process_trace test PASSED")
5555

5656

5757
def test_process_trace_python_hook():
@@ -112,7 +112,7 @@ def remove_hook(lru_dict, obj_id):
112112
assert 0.0 <= miss_ratio1 <= 1.0, f"Invalid miss ratio 1: {miss_ratio1}"
113113
assert 0.0 <= miss_ratio2 <= 1.0, f"Invalid miss ratio 2: {miss_ratio2}"
114114
assert abs(miss_ratio1 - miss_ratio2) < 0.001, f"Different results from the two methods: {miss_ratio1} vs {miss_ratio2}"
115-
print(" Python hook process_trace test PASSED")
115+
print("PASS: Python hook process_trace test PASSED")
116116

117117

118118
def test_compare_native_vs_python_hook():
@@ -164,7 +164,7 @@ def remove_hook(lru_dict, obj_id):
164164

165165
# They should be very similar (allowing for some small differences due to implementation details)
166166
assert abs(native_miss_ratio - hook_miss_ratio) < 0.05, f"Too much difference: {abs(native_miss_ratio - hook_miss_ratio):.4f}"
167-
print(" Native vs Python hook comparison test PASSED")
167+
print("PASS: Native vs Python hook comparison test PASSED")
168168

169169

170170
def test_error_handling():
@@ -184,7 +184,7 @@ def test_error_handling():
184184
assert False, "Should have raised RuntimeError"
185185
except RuntimeError as e:
186186
print(f"Correctly caught error: {e}")
187-
print(" Error handling test PASSED")
187+
print("PASS: Error handling test PASSED")
188188

189189

190190
def test_lru_implementation_accuracy():
@@ -223,7 +223,7 @@ def test_lru_implementation_accuracy():
223223

224224
# Assert that the difference is small (< 5%)
225225
assert percentage_diff < 5.0, f"LRU implementation difference too large: {percentage_diff:.4f}%"
226-
print(" LRU implementation accuracy test passed")
226+
print("PASS: LRU implementation accuracy test passed")
227227

228228

229229
def create_optimized_lru_hooks():
@@ -263,12 +263,12 @@ def remove_hook(lru_dict, obj_id):
263263
for test in tests:
264264
try:
265265
test() # Just call the test, don't check return value
266-
print(f" {test.__name__} passed")
266+
print(f"PASS: {test.__name__} passed")
267267
except Exception as e:
268-
print(f" {test.__name__} failed with exception: {e}")
268+
print(f"FAIL: {test.__name__} failed with exception: {e}")
269269
all_passed = False
270270

271271
if all_passed:
272-
print("\n🎉 All process_trace tests PASSED!")
272+
print("\nAll process_trace tests PASSED!")
273273
else:
274-
print("\n❌ Some process_trace tests FAILED!")
274+
print("\nSome process_trace tests FAILED!")

libCacheSim-python/tests/test_python_hook_cache.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ def remove_hook(lru_dict, obj_id):
168168
print(f"Request {i+1}: obj_id={obj_id}")
169169
print(f" Native LRU: {'HIT' if native_result else 'MISS'}")
170170
print(f" Hook LRU: {'HIT' if hook_result else 'MISS'}")
171-
print(f" Match: {'' if match else ''}")
171+
print(f" Match: {'PASS' if match else 'FAIL'}")
172172

173173
# Compare cache statistics
174174
stats_match = (native_lru.cache.n_obj == hook_lru.n_obj and
175175
native_lru.cache.occupied_byte == hook_lru.occupied_byte)
176176
print(f" Native stats: {native_lru.cache.n_obj} objects, {native_lru.cache.occupied_byte} bytes")
177177
print(f" Hook stats: {hook_lru.n_obj} objects, {hook_lru.occupied_byte} bytes")
178-
print(f" Stats match: {'' if stats_match else ''}")
178+
print(f" Stats match: {'PASS' if stats_match else 'FAIL'}")
179179
print()
180180

181181
if not match:
@@ -193,7 +193,7 @@ def remove_hook(lru_dict, obj_id):
193193
print(f" Accuracy: {accuracy:.1f}%")
194194

195195
assert accuracy == 100.0, f"LRU implementations differ! Accuracy: {accuracy:.1f}%"
196-
print(" LRU comparison test PASSED - Both implementations behave identically!")
196+
print("PASS: LRU comparison test PASSED - Both implementations behave identically!")
197197

198198

199199
def test_lru_comparison_variable_sizes():
@@ -264,18 +264,18 @@ def remove_hook(lru_dict, obj_id):
264264
print(f"Request {i+1}: obj_id={obj_id}, size={obj_size}")
265265
print(f" Native LRU: {'HIT' if native_result else 'MISS'}")
266266
print(f" Hook LRU: {'HIT' if hook_result else 'MISS'}")
267-
print(f" Result match: {'' if result_match else ''}")
267+
print(f" Result match: {'PASS' if result_match else 'FAIL'}")
268268
print(f" Native stats: {native_lru.cache.n_obj} objects, {native_lru.cache.occupied_byte} bytes")
269269
print(f" Hook stats: {hook_lru.n_obj} objects, {hook_lru.occupied_byte} bytes")
270-
print(f" Stats match: {'' if stats_match else ''}")
270+
print(f" Stats match: {'PASS' if stats_match else 'FAIL'}")
271271
print()
272272

273273
if not result_match or not stats_match:
274274
all_match = False
275275
print(f"ERROR: Mismatch at request {i+1}")
276276

277277
assert all_match, "Variable size LRU comparison failed - implementations differ!"
278-
print(" Variable size LRU comparison test PASSED!")
278+
print("PASS: Variable size LRU comparison test PASSED!")
279279

280280

281281
if __name__ == "__main__":

libCacheSim-python/tests/test_unified_interface.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_unified_process_trace_interface():
100100
print(f"{name:15s}: miss_ratio = {miss_ratio:.4f}")
101101
print(f" cache stats: {cache.n_obj} objects, {cache.occupied_byte} bytes")
102102

103-
print(f"\n All {len(caches)} cache policies support unified process_trace interface!")
103+
print(f"\nPASS: All {len(caches)} cache policies support unified process_trace interface!")
104104
# Test passes - no explicit return needed for pytest
105105

106106

@@ -133,7 +133,7 @@ def test_unified_properties_interface():
133133
# Test cache_size is correct
134134
assert cache.cache_size == cache_size, f"{name} cache_size mismatch"
135135

136-
print(" All cache policies support unified properties interface!")
136+
print("PASS: All cache policies support unified properties interface!")
137137
# Test passes - no explicit return needed for pytest
138138

139139

@@ -175,7 +175,7 @@ def test_get_interface_consistency():
175175
assert cache.n_obj > 0, f"{name} n_obj not updated"
176176
assert cache.occupied_byte > 0, f"{name} occupied_byte not updated"
177177

178-
print(" Get interface consistency test passed!")
178+
print("PASS: Get interface consistency test passed!")
179179
# Test passes - no explicit return needed for pytest
180180

181181

@@ -190,12 +190,12 @@ def test_get_interface_consistency():
190190
for test in tests:
191191
try:
192192
test() # Just call the test, don't check return value
193-
print(f" {test.__name__} passed")
193+
print(f"PASS: {test.__name__} passed")
194194
except Exception as e:
195-
print(f" {test.__name__} failed with exception: {e}")
195+
print(f"FAIL: {test.__name__} failed with exception: {e}")
196196
all_passed = False
197197

198198
if all_passed:
199-
print("\n🎉 All unified interface tests PASSED!")
199+
print("\nAll unified interface tests PASSED!")
200200
else:
201-
print("\n❌ Some unified interface tests FAILED!")
201+
print("\nSome unified interface tests FAILED!")

0 commit comments

Comments
 (0)