28 lines
676 B
Ruby
28 lines
676 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe WAG::Memory do
|
|
let(:number) { rand(99) }
|
|
let(:min) { nil }
|
|
let(:max) { nil }
|
|
subject { described_class.new(number, min, max) }
|
|
|
|
describe '#to_sexpr' do
|
|
subject { super().to_sexpr }
|
|
|
|
describe 'When there is no minumum value' do
|
|
it { is_expected.to eq [:memory, number] }
|
|
end
|
|
|
|
describe 'When there is a minumum value' do
|
|
let(:min) { rand(99) }
|
|
it { is_expected.to eq [:memory, number, min] }
|
|
|
|
describe 'When there is a max value' do
|
|
let(:max) { min + rand(99) }
|
|
it { is_expected.to eq [:memory, number, min, max] }
|
|
end
|
|
end
|
|
end
|
|
end
|