~singpolyma/sgx-jmp

ref: 6665370def4be4097eda0de37d29c288954936ed sgx-jmp/test/test_ibr.rb -rw-r--r-- 782 bytes
6665370dStephen Paul Weber No low balance if not registered 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# frozen_string_literal: true

require "test_helper"
require "ibr"

class IBRTest < Minitest::Test
	property(:registered) { boolean }
	def registered(val)
		ibr = IBR.new
		ibr.registered = val
		assert_equal val, ibr.registered?
	end

	{
		instructions: :string,
		username: :string,
		nick: :string,
		password: :string,
		name: :string,
		first: :string,
		last: :string,
		email: :string,
		address: :string,
		city: :string,
		state: :string,
		zip: :string,
		phone: [:string, :digit],
		url: :string,
		date: ->(*) { Time.at(range(0, 4294967295)).iso8601 }
	}.each do |prop, type|
		property("prop_#{prop}") { call(type) }
		define_method("prop_#{prop}") do |val|
			ibr = IBR.new
			ibr.public_send("#{prop}=", val)
			assert_equal val, ibr.public_send(prop)
		end
	end
end