Friday, 15 December 2017
arrow JDiceChecker 5.0.0.1 arrow RandomTest arrow RandomTestSuite.java (2)
RandomTestSuite.java (2nd part) (Random Test Suite class for all random number tests) Print E-mail
Get C++ DiceLock cipher architecture source code packages of DiceLock for Microsoft Visual Studio 2013 and DiceLock-x for Linux with Test Driver Programs and Response Test Vector files to verify that both them work as expected.
DiceLock for Windows and Linux
DiceLock Security governing software licenses are Free/Libre Source Code License and Educational and Research License
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
 
    // GETTING RANDOM TESTS
    
  /**
   * Gets a random test to the suite based in the enumerated random tests
   * 
   * @param     test              RandomTests enumeration value pointing the random number test to be returned
   * @return    BaseRandomTest:   Random number test object selected
   */ 
    public BaseRandomTest GetRandomTest(RandomTests test) {
          
        return this.suite[test.ordinal()];
    }
 
  /**
   * Gets Frequency random test of the suite
   * 
   * @return    FrequencyTest     Frequency random test object in the suite
   */ 
    public FrequencyTest GetFrequencyTest() {
          
        return (FrequencyTest)this.suite[RandomTests.Frequency.ordinal()];
    }
 
  /**
   * Gets Block Frequency random test of the suite
   * 
   * @return    BlockFrequencyTest     Block Frequency random test object in the suite
   */ 
    public BlockFrequencyTest GetBlockFrequencyTest() {
          
        return (BlockFrequencyTest)this.suite[RandomTests.BlockFrequency.ordinal()];
    }
 
  /**
   * Gets Runs random test of the suite
   * 
   * @return    RunsTest     Runs random test object in the suite
   */ 
    public RunsTest GetRunsTest() {
          
        return (RunsTest)this.suite[RandomTests.Runs.ordinal()];
    }
 
  /**
   * Gets Longest Run Of Ones random test of the suite
   * 
   * @return    LongestRunOfOnesTest     Longest Run Of Ones random test object in the suite
   */ 
    public LongestRunOfOnesTest GetLongestRunOfOnesTest() {
          
      return (LongestRunOfOnesTest)this.suite[RandomTests.LongestRunOfOnes.ordinal()];
    }
 
  /**
   * Gets Cumulative Sum Forward random test of the suite
   * 
   * @return    CumulativeSumForwardTest     Cumulative Sum Forward random test object in the suite
   */ 
    public CumulativeSumForwardTest GetCumulativeSumForwardTest() {
          
        return (CumulativeSumForwardTest)this.suite[RandomTests.CumulativeSumForward.ordinal()];
    }
 
  /**
   * Gets Cumulative Sum Reverse random test of the suite
   * 
   * @return    CumulativeSumReverseTest     Cumulative Sum Reverse random test object in the suite
   */ 
    public CumulativeSumReverseTest GetCumulativeSumReverseTest() {
          
        return (CumulativeSumReverseTest)this.suite[RandomTests.CumulativeSumReverse.ordinal()];
    }
 
  /**
   * Gets Rank random test of the suite
   * 
   * @return    RankTest     Rank random test object in the suite
   */ 
    public RankTest GetRankTest() {
          
        return (RankTest)this.suite[RandomTests.Rank.ordinal()];
    }
 
  /**
   * Gets Universal random test of the suite
   * 
   * @return    UniversalTest     Universal random test object in the suite
   */ 
    public UniversalTest GetUniversalTest() {
          
        return (UniversalTest)this.suite[RandomTests.Universal.ordinal()];
    }
 
  /**
   * Gets Approximate Entropy random test of the suite
   * 
   * @return    ApproximateEntropyTest     Approximate Entropy random test object in the suite
   */ 
    public ApproximateEntropyTest GetApproximateEntropyTest() {
          
        return (ApproximateEntropyTest)this.suite[RandomTests.ApproximateEntropy.ordinal()];
    }
 
  /**
   * Gets Serial random test of the suite
   * 
   * @return    SerialTest     Serial random test object in the suite
   */ 
    public SerialTest GetSerialTest() {
          
        return (SerialTest)this.suite[RandomTests.Serial.ordinal()];
    }
 
  /**
   * Gets Discrete Fourier Transform random test of the suite
   * 
   * @return    DiscreteFourierTransformTest     Discrete Fourier Transform random test object in the suite
   */ 
    public DiscreteFourierTransformTest GetDiscreteFourierTransformTest() {
          
        return (DiscreteFourierTransformTest)this.suite[RandomTests.DiscreteFourierTransform.ordinal()];
    }
 
    // REMOVING RANDOM TESTS
 
  /**
   * Removes a random test to the suite
   * 
   * @param     test      Random number test object to be removed from the suite
   */ 
    public void Remove(BaseRandomTest test) {
        RandomTests randomTest;
 
        randomTest = test.GetType();
        if ((this.suite[randomTest.ordinal()] != null) && (this.suite[randomTest.ordinal()] == test)) {
          if (this.selfCreatedTest[randomTest.ordinal()]) {
            this.suite[randomTest.ordinal()] = null;
          }
          this.suite[randomTest.ordinal()] = null;
          this.selfCreatedTest[randomTest.ordinal()] = false;
          this.instantiatedTests--;
        }
    }
 
  /**
   * Removes a random test to the suite based in the enumerated random tests
   * 
   * @param     test      RandomTests enumeration value indicating the random test to be removed from the suite
   */ 
    public void Remove(RandomTests test) {
          
      if (this.suite[test.ordinal()] != null) {
        if (this.selfCreatedTest[test.ordinal()]) {
          this.suite[test.ordinal()] = null;
        }
        this.suite[test.ordinal()] = null;
        this.selfCreatedTest[test.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes all random test of the suite
   * 
   */ 
    public void RemoveAll() {
      int i;
 
      for (i = this.GetFirstTest().ordinal(); i < this.GetMaximumNumberOfTests().ordinal(); i++) {
        if (this.suite[i] != null) {
          if (this.selfCreatedTest[i]) {
            this.suite[i] = null;
          }
          this.suite[i] = null;
          this.selfCreatedTest[i] = false;
        }
      }
      this.instantiatedTests = 0;
    }
 
  /**
   * Removes Frequency random test from the suite
   * 
   */ 
    public void RemoveFrequencyTest() {
          
      if (this.suite[RandomTests.Frequency.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.Frequency.ordinal()]) {
          this.suite[RandomTests.Frequency.ordinal()] = null;
        }
        this.suite[RandomTests.Frequency.ordinal()] = null;
        this.selfCreatedTest[RandomTests.Frequency.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Block Frequency random test from the suite
   * 
   */ 
    public void RemoveBlockFrequencyTest() {
          
      if (this.suite[RandomTests.BlockFrequency.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.BlockFrequency.ordinal()]) {
          this.suite[RandomTests.BlockFrequency.ordinal()] = null;
        }
        this.suite[RandomTests.BlockFrequency.ordinal()] = null;
        this.selfCreatedTest[RandomTests.BlockFrequency.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Runs random test from the suite
   * 
   */ 
    public void RemoveRunsTest() {
          
      if (this.suite[RandomTests.Runs.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.Runs.ordinal()]) {
          this.suite[RandomTests.Runs.ordinal()] = null;
        }
        this.suite[RandomTests.Runs.ordinal()] = null;
        this.selfCreatedTest[RandomTests.Runs.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Longest Run Of Ones random test from the suite
   * 
   */ 
    public void RemoveLongestRunOfOnesTest() {
          
      if (this.suite[RandomTests.LongestRunOfOnes.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.LongestRunOfOnes.ordinal()]) {
          this.suite[RandomTests.LongestRunOfOnes.ordinal()]= null;
        }
        this.suite[RandomTests.LongestRunOfOnes.ordinal()] = null;
        this.selfCreatedTest[RandomTests.LongestRunOfOnes.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Cumulative Sum Forward random test from the suite
   * 
   */ 
    public void RemoveCumulativeSumForwardTest() {
          
      if (this.suite[RandomTests.CumulativeSumForward.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.CumulativeSumForward.ordinal()]) {
          this.suite[RandomTests.CumulativeSumForward.ordinal()] = null;
        }
        this.suite[RandomTests.CumulativeSumForward.ordinal()] = null;
        this.selfCreatedTest[RandomTests.CumulativeSumForward.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Cumulative Sum Reverse random test from the suite
   * 
   */ 
    public void RemoveCumulativeSumReverseTest() {
          
      if (this.suite[RandomTests.CumulativeSumReverse.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.CumulativeSumReverse.ordinal()]) {
          this.suite[RandomTests.CumulativeSumReverse.ordinal()] = null;
        }
        this.suite[RandomTests.CumulativeSumReverse.ordinal()] = null;
        this.selfCreatedTest[RandomTests.CumulativeSumReverse.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Rank random test from the suite
   * 
   */ 
    public void RemoveRankTest() {
          
      if (this.suite[RandomTests.Rank.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.Rank.ordinal()]) {
          this.suite[RandomTests.Rank.ordinal()] = null;
        }
        this.suite[RandomTests.Rank.ordinal()] = null;
        this.selfCreatedTest[RandomTests.Rank.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Universal random test from the suite
   * 
   */ 
    public void RemoveUniversalTest() {
          
      if (this.suite[RandomTests.Universal.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.Universal.ordinal()]) {
          this.suite[RandomTests.Universal.ordinal()] = null;
        }
        this.suite[RandomTests.Universal.ordinal()] = null;
        this.selfCreatedTest[RandomTests.Universal.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Approximate Entropy random test from the suite
   * 
   */ 
    public void RemoveApproximateEntropyTest() {
          
      if (this.suite[RandomTests.ApproximateEntropy.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.ApproximateEntropy.ordinal()]) {
          this.suite[RandomTests.ApproximateEntropy.ordinal()] = null;
        }
        this.suite[RandomTests.ApproximateEntropy.ordinal()] = null;
        this.selfCreatedTest[RandomTests.ApproximateEntropy.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Serial random test from the suite
   * 
   */ 
    public void RemoveSerialTest() {
          
      if (this.suite[RandomTests.Serial.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.Serial.ordinal()]) {
          this.suite[RandomTests.Serial.ordinal()] = null;
        }
        this.suite[RandomTests.Serial.ordinal()] = null;
        this.selfCreatedTest[RandomTests.Serial.ordinal()] = false;
        this.instantiatedTests--;
      }
    }
 
  /**
   * Removes Discrete Fourier Transform random test from the suite
   * 
   */ 
    public void RemoveDiscreteFourierTransformTest() {
          
      if (this.suite[RandomTests.DiscreteFourierTransform.ordinal()] != null) {
        if (this.selfCreatedTest[RandomTests.DiscreteFourierTransform.ordinal()]) {
          this.suite[RandomTests.DiscreteFourierTransform.ordinal()] = null;
        }
        this.suite[RandomTests.DiscreteFourierTransform.ordinal()] = null;
        this.selfCreatedTest[RandomTests.DiscreteFourierTransform.ordinal()] = false;
        this.instantiatedTests--;
      }
    }