-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWalletBalanceGeneratorTest.m
More file actions
31 lines (25 loc) · 953 Bytes
/
WalletBalanceGeneratorTest.m
File metadata and controls
31 lines (25 loc) · 953 Bytes
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
classdef WalletBalanceGeneratorTest < matlab.unittest.TestCase
methods (Test)
function testWalletDistributionInitialization(TestCase)
C = 1000000;
rate = 0.1;
distr = WalletBalanceGenerator(C, rate);
TestCase.verifyEqual(distr.TotalTokenSupply, C);
TestCase.verifyEqual(distr.Rate, rate);
end
function testPlotDistribution(TestCase)
% plot histogram of the probability distribution built from
% a set of randomly generated wallets
C = 1000000000;
rate = 0.000001;
distr = WalletBalanceGenerator(C, rate);
% choose number of random wallets to consider
n = 100000;
x = zeros(1, n);
for i = 1:n
x(i) = distr.rndWalletBalance();
end
histogram(x);
end
end
end