Check-in [7a89ccc39d]
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Overview
Comment:Added random bytes test cases
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | crypto
Files: files | file ages | folders
SHA3-256: 7a89ccc39da442648a47e0f9c41f3a025721ddde073131969ed48fba7f619513
User & Date: bohagan on 2023-12-28 03:57:44
Other Links: branch diff | manifest | tags
Context
2023-12-28
05:05
More documentation updates check-in: d371821677 user: bohagan tags: crypto
03:57
Added random bytes test cases check-in: 7a89ccc39d user: bohagan tags: crypto
03:02
Added random bytes command documentation check-in: 2eb1cc571b user: bohagan tags: crypto
Changes

Added tests/random.csv version [3cadea583e].

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Group,Name,Constraints,Setup,Body,Cleanup,Match,Result,Output,Error Output,Return Codes
command,package require tls,,,,,,,,,
,,,,,,,,,,
command,# Random command,,,,,,,,,
Random,Min Length,,,string length [::tls::random 0],,,0,,,
Random,Example 1,,,string length [::tls::random 42],,,42,,,
Random,Example 2,,,string length [::tls::random 1000],,,1000,,,
Random,Private Option,,,string length [::tls::random -private 42],,,42,,,
,,,,,,,,,,
command,# Random command errors,,,,,,,,,
Random Errors,Too few args,,,::tls::random,,,"wrong # args: should be ""tls::random ?-private? length""",,,1
Random Errors,Too many args,,,::tls::random too many command line args to pass the test without an error or failing,,,"wrong # args: should be ""tls::random ?-private? length""",,,1
Random Errors,Invalid length value,,,::tls::random bogus,,,"expected integer but got ""bogus""",,,1
Random Errors,Negative length,,,::tls::random -1,,,"bad count ""-1"": must be integer >= 0",,,1
Random Errors,Invalid option,,,::tls::random -bogus 42,,,"bad option ""-bogus"": must be -private",,,1
Random Errors,Invalid length with option,,,::tls::random -private bogus,,,"expected integer but got ""bogus""",,,1

Added tests/random.test version [df2018eb63].



























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
# Auto generated test cases for random.csv

# Load Tcl Test package
if {[lsearch [namespace children] ::tcltest] == -1} {
	package require tcltest
	namespace import ::tcltest::*
}

set auto_path [concat [list [file dirname [file dirname [info script]]]] $auto_path]

package require tls

# Random command


test Random-1.1 {Min Length} -body {
	string length [::tls::random 0]
    } -result {0}

test Random-1.2 {Example 1} -body {
	string length [::tls::random 42]
    } -result {42}

test Random-1.3 {Example 2} -body {
	string length [::tls::random 1000]
    } -result {1000}

test Random-1.4 {Private Option} -body {
	string length [::tls::random -private 42]
    } -result {42}

# Random command errors


test Random_Errors-2.1 {Too few args} -body {
	::tls::random
    } -result {wrong # args: should be "tls::random ?-private? length"} -returnCodes {1}

test Random_Errors-2.2 {Too many args} -body {
	::tls::random too many command line args to pass the test without an error or failing
    } -result {wrong # args: should be "tls::random ?-private? length"} -returnCodes {1}

test Random_Errors-2.3 {Invalid length value} -body {
	::tls::random bogus
    } -result {expected integer but got "bogus"} -returnCodes {1}

test Random_Errors-2.4 {Negative length} -body {
	::tls::random -1
    } -result {bad count "-1": must be integer >= 0} -returnCodes {1}

test Random_Errors-2.5 {Invalid option} -body {
	::tls::random -bogus 42
    } -result {bad option "-bogus": must be -private} -returnCodes {1}

test Random_Errors-2.6 {Invalid length with option} -body {
	::tls::random -private bogus
    } -result {expected integer but got "bogus"} -returnCodes {1}

# Cleanup
::tcltest::cleanupTests
return