formatting fixes, add editorconfig, remove garbage from nimble file

This commit is contained in:
gmega 2023-08-11 19:08:15 -03:00
parent f70988020b
commit 5509594cd9
6 changed files with 15 additions and 20 deletions

5
.editorconfig Normal file
View File

@ -0,0 +1,5 @@
[*]
indent_style = space
insert_final_newline = true
indent_size = 2
trim_trailing_whitespace = true

View File

@ -1,19 +1,13 @@
# Package # Package
version = "0.1.0" version = "0.1.0"
author = "gmega" author = "Swarmsim Authors"
description = "Simple swarm simulator" description = "Simple swarm simulator"
license = "MIT" license = "MIT"
srcDir = "src" srcDir = "."
installExt = @["nim"] installExt = @["nim"]
bin = @["swarm_sim"]
requires "nim >= 1.6.0"
# Dependencies
requires "nim >= 2.0.0"
# Tasks
task test, "Run unit tests": task test, "Run unit tests":
exec "nim c -r tests/all_tests.nim" exec "nim c -r tests/all_tests.nim"

View File

@ -22,10 +22,10 @@ proc nextStep*(self: EventDrivenEngine): Option[Schedulable] =
schedulable.scheduled(engine = self) schedulable.scheduled(engine = self)
some(schedulable) some(schedulable)
proc run*(self: EventDrivenEngine): void = proc run*(self: EventDrivenEngine): void =
while self.nextStep().isSome: while self.nextStep().isSome:
discard discard
export EventDrivenEngine export EventDrivenEngine
export options export options

View File

@ -6,4 +6,4 @@ func `<`*(self: Schedulable, other: Schedulable): bool =
method scheduled*(self: Schedulable, engine: EventDrivenEngine): void {.base.} = method scheduled*(self: Schedulable, engine: EventDrivenEngine): void {.base.} =
quit "unimplemented" quit "unimplemented"
export Schedulable export Schedulable

View File

@ -11,4 +11,4 @@ type
current_time*: uint64 current_time*: uint64
queue*: HeapQueue[Schedulable] queue*: HeapQueue[Schedulable]
export heapqueue export heapqueue

View File

@ -24,7 +24,7 @@ suite "event driven engine tests":
let engine = EventDrivenEngine() let engine = EventDrivenEngine()
engine.scheduleAll(schedulables) engine.scheduleAll(schedulables)
for time in times.sorted: for time in times.sorted:
let result = engine.nextStep().get() let result = engine.nextStep().get()
check(result.time == time) check(result.time == time)
@ -33,7 +33,3 @@ suite "event driven engine tests":
for schedulable in schedulables: for schedulable in schedulables:
check(schedulable.scheduledAt == schedulable.time) check(schedulable.scheduledAt == schedulable.time)