summary refs log tree commit diff stats
path: root/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim')
-rw-r--r--tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
index 7181145e9..379ec7364 100644
--- a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
+++ b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim
@@ -1,3 +1,7 @@
+discard """
+action: compile
+"""
+
 import os, parseutils, threadpool, strutils
 
 type
@@ -54,9 +58,9 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) =
     while chunkLen >= 0 and buffer[chunkLen - 1] notin NewLines:
       chunkLen.dec
 
-    responses.add(spawn parseChunk(buffer[0 .. <chunkLen]))
+    responses.add(spawn parseChunk(buffer[0 ..< chunkLen]))
     oldBufferLen = readSize - chunkLen
-    buffer[0 .. <oldBufferLen] = buffer[readSize - oldBufferLen .. ^1]
+    buffer[0 ..< oldBufferLen] = buffer[readSize - oldBufferLen .. ^1]
 
   var mostPopular = newStats()
   for resp in responses:
@@ -66,7 +70,7 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) =
 
   echo("Most popular is: ", mostPopular)
 
-when isMainModule:
+when true:
   const file = "pagecounts-20160101-050000"
   let filename = getCurrentDir() / file
-  readPageCounts(filename)
\ No newline at end of file
+  readPageCounts(filename)