diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1963f8d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +[*] +indent_style = space +insert_final_newline = true +indent_size = 2 +trim_trailing_whitespace = true \ No newline at end of file diff --git a/swarmsim.nimble b/swarmsim.nimble index cbfc26f..d4fc028 100644 --- a/swarmsim.nimble +++ b/swarmsim.nimble @@ -1,19 +1,13 @@ # Package version = "0.1.0" -author = "gmega" +author = "Swarmsim Authors" description = "Simple swarm simulator" license = "MIT" -srcDir = "src" +srcDir = "." installExt = @["nim"] -bin = @["swarm_sim"] +requires "nim >= 1.6.0" -# Dependencies - -requires "nim >= 2.0.0" - - -# Tasks task test, "Run unit tests": - exec "nim c -r tests/all_tests.nim" \ No newline at end of file + exec "nim c -r tests/all_tests.nim" diff --git a/swarmsim/eventdrivenengine.nim b/swarmsim/eventdrivenengine.nim index 7de51c5..8326be2 100644 --- a/swarmsim/eventdrivenengine.nim +++ b/swarmsim/eventdrivenengine.nim @@ -22,10 +22,10 @@ proc nextStep*(self: EventDrivenEngine): Option[Schedulable] = schedulable.scheduled(engine = self) some(schedulable) - + proc run*(self: EventDrivenEngine): void = while self.nextStep().isSome: discard - + export EventDrivenEngine -export options \ No newline at end of file +export options diff --git a/swarmsim/schedulable.nim b/swarmsim/schedulable.nim index 8d2da7a..be2b367 100644 --- a/swarmsim/schedulable.nim +++ b/swarmsim/schedulable.nim @@ -6,4 +6,4 @@ func `<`*(self: Schedulable, other: Schedulable): bool = method scheduled*(self: Schedulable, engine: EventDrivenEngine): void {.base.} = quit "unimplemented" -export Schedulable \ No newline at end of file +export Schedulable diff --git a/swarmsim/types.nim b/swarmsim/types.nim index 3c5c487..2f5ed51 100644 --- a/swarmsim/types.nim +++ b/swarmsim/types.nim @@ -11,4 +11,4 @@ type current_time*: uint64 queue*: HeapQueue[Schedulable] -export heapqueue \ No newline at end of file +export heapqueue diff --git a/tests/swarmsim/eventdrivenengine.nim b/tests/swarmsim/eventdrivenengine.nim index 018936b..67937f7 100644 --- a/tests/swarmsim/eventdrivenengine.nim +++ b/tests/swarmsim/eventdrivenengine.nim @@ -24,7 +24,7 @@ suite "event driven engine tests": let engine = EventDrivenEngine() engine.scheduleAll(schedulables) - + for time in times.sorted: let result = engine.nextStep().get() check(result.time == time) @@ -33,7 +33,3 @@ suite "event driven engine tests": for schedulable in schedulables: check(schedulable.scheduledAt == schedulable.time) - - - -