Sha256: 05e5b774c43d76ad68bb407b6e1155599cf2dea0505d033a648abc793a0aa906

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

# encoding: utf-8

require 'simplest_benchmark'

include SimplestBenchmark

RSpec.describe SimplestBenchmark do

		context "with simple calls" do

			it "returns time_spent > 0" do
				sb_begin("iteration")

					10.times {|i| i*10}

				t = sb_end("iteration")
				expect(t).to be > 0
			end

			it "logs correctly" do
				pending("not implemented yet.")
    		fail
			end
		end

		context "with nested calls" do
			it "returns coherent time spent" do
				t,t0 = 0

				sb_begin("iteration1")

					10.times {|i|
						i*10

						sb_begin("iteration2")

						20.times{|j|
							j*10
						}

						t0 = sb_end("iteration2")
					}

				t = sb_end("iteration")
				expect(t).to be > t0
			end

			it "logs correctly" do
				pending("not implemented yet.")
    		fail
			end
		end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simplest_benchmark-0.0.3 spec/lib/simplest_benchmark_spec.rb