~singpolyma/sgx-jmp

ref: 045da39f25b74034e7bba44cb5f1db48a935ba84 sgx-jmp/test/test_ibr.rb -rw-r--r-- 782 bytes
045da39fStephen Paul Weber Hotfix: arguments in wrong order 2 years 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