Tcl Source Code

Check-in [e4a8d48058]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test cases. One failure...
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tip-450
Files: files | file ages | folders
SHA3-256: e4a8d4805867c808025dc1e23b3251637fc6a1ff62fca0eb6e8ca32488fdbc92
User & Date: dkf 2019-06-14 09:11:45
Context
2019-06-14
20:30
Fix the bug; set current end to end of input string so @* can go there. check-in: 9df20cff69 user: dkf tags: tip-450
09:11
Test cases. One failure... check-in: e4a8d48058 user: dkf tags: tip-450
2019-06-12
07:33
start of conversion tests check-in: a96fdd0411 user: dkf tags: tip-450
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/binary.test.

2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034



























































































































































































































































































































































































































3035
3036
3037
3038
3039
3040
3041
3042
3043
} -cleanup {
    unset -nocomplain x
} -result {1 {expected integer but got "gorp"} 0}

test binary-80.1 {binary set: a} {
    set x abc
    binary set x a A
    return $x
} Abc
test binary-80.2 {binary set: a} {
    set x abc
    binary set x a* AB
    return $x
} ABc
test binary-80.3 {binary set: a} {
    set x abc
    binary set x a1 AB
    return $x
} Abc
test binary-80.4 {binary set: a} {
    set x abc
    binary set x a2 A
    scan $x %c%c%c
} {65 0 99}

test binary-81.1 {binary set: A} {
    set x abc
    binary set x A A
    return $x
} Abc
test binary-81.2 {binary set: A} {
    set x abc
    binary set x A* AB
    return $x
} ABc
test binary-81.3 {binary set: A} {
    set x abc
    binary set x A1 AB
    return $x
} Abc
test binary-81.4 {binary set: A} {
    set x abc
    binary set x A2 A
    scan $x %c%c%c
} {65 32 99}

test binary-82.1 {binary set: b} {
    set x abc
    binary set x b 10101010
    scan $x %c%c%c
} {1 98 99}
test binary-82.2 {binary set: b} {
    set x abc
    binary set x b* 1010101011011010
    return $x
} "U\[c"
test binary-82.3 {binary set: b} {
    set x abc
    binary set x b4 1010101010101010
    scan $x %c%c%c
} {5 98 99}

test binary-83.1 {binary set: B} {
    set x abc
    binary set x B 10101010
    scan $x %c%c%c
} {128 98 99}
test binary-83.2 {binary set: B} {
    set x abc
    binary set x B* 0101010101101101
    return $x
} Umc
test binary-83.3 {binary set: B} {
    set x abc
    binary set x B4 1010101010101010
    scan $x %c%c%c
} {160 98 99}
 



























































































































































































































































































































































































































# ----------------------------------------------------------------------
# cleanup

::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End:






|
|



|
|



|
|



|
|




|
|



|
|



|
|



|
|




|
|



|
|



|
|




|
|



|
|



|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
} -cleanup {
    unset -nocomplain x
} -result {1 {expected integer but got "gorp"} 0}

test binary-80.1 {binary set: a} {
    set x abc
    binary set x a A
    binary encode hex $x
} 416263
test binary-80.2 {binary set: a} {
    set x abc
    binary set x a* AB
    binary encode hex $x
} 414263
test binary-80.3 {binary set: a} {
    set x abc
    binary set x a1 AB
    binary encode hex $x
} 416263
test binary-80.4 {binary set: a} {
    set x abc
    binary set x a2 A
    binary encode hex $x
} 410063

test binary-81.1 {binary set: A} {
    set x abc
    binary set x A A
    binary encode hex $x
} 416263
test binary-81.2 {binary set: A} {
    set x abc
    binary set x A* AB
    binary encode hex $x
} 414263
test binary-81.3 {binary set: A} {
    set x abc
    binary set x A1 AB
    binary encode hex $x
} 416263
test binary-81.4 {binary set: A} {
    set x abc
    binary set x A2 A
    binary encode hex $x
} 412063

test binary-82.1 {binary set: b} {
    set x abc
    binary set x b 10101010
    binary encode hex $x
} 016263
test binary-82.2 {binary set: b} {
    set x abc
    binary set x b* 1010101011011010
    binary encode hex $x
} 555b63
test binary-82.3 {binary set: b} {
    set x abc
    binary set x b4 1010101010101010
    binary encode hex $x
} 056263

test binary-83.1 {binary set: B} {
    set x abc
    binary set x B 10101010
    binary encode hex $x
} 806263
test binary-83.2 {binary set: B} {
    set x abc
    binary set x B* 0101010101101101
    binary encode hex $x
} 556d63
test binary-83.3 {binary set: B} {
    set x abc
    binary set x B4 1010101010101010
    binary encode hex $x
} a06263

test binary-84.1 {binary set: c} {
    set x abc
    binary set x c 65
    binary encode hex $x
} 416263
test binary-84.2 {binary set: c} {
    set x abc
    binary set x c* {65 66}
    binary encode hex $x
} 414263
test binary-84.3 {binary set: c} {
    set x abcdef
    binary set x c4 {65 66 67 68 69}
    binary encode hex $x
} 414243446566

test binary-85.1 {binary set: h} {
    set x abc
    binary set x h abcdef
    binary encode hex $x
} 0a6263
test binary-85.2 {binary set: h} {
    set x abc
    binary set x h* 1424
    binary encode hex $x
} 414263
test binary-85.3 {binary set: h} {
    set x abc
    binary set x h4 142434
    binary encode hex $x
} 414263

test binary-86.1 {binary set: H} {
    set x abc
    binary set x H abcdef
    binary encode hex $x
} a06263
test binary-86.2 {binary set: H} {
    set x abc
    binary set x H* 4142
    binary encode hex $x
} 414263
test binary-86.3 {binary set: H} {
    set x abc
    binary set x H4 414243
    binary encode hex $x
} 414263

test binary-87.1 {binary set: s} {
    set x abcdef
    binary set x s 65
    binary encode hex $x
} 410063646566
test binary-87.2 {binary set: s} {
    set x abcdef
    binary set x s* {65 66}
    binary encode hex $x
} 410042006566
test binary-87.3 {binary set: s} {
    set x abcdef
    binary set x s2 {65 -66 67 68 69}
    binary encode hex $x
} 4100beff6566

test binary-88.1 {binary set: S} {
    set x abcdef
    binary set x S 65
    binary encode hex $x
} 004163646566
test binary-88.2 {binary set: S} {
    set x abcdef
    binary set x S* {65 66}
    binary encode hex $x
} 004100426566
test binary-88.3 {binary set: S} {
    set x abcdef
    binary set x S2 {65 -66 67 68 69}
    binary encode hex $x
} 0041ffbe6566

test binary-89.1.BE {binary set: t} bigEndian {
    set x abcdef
    binary set x t 65
    binary encode hex $x
} 004163646566
test binary-89.2.BE {binary set: t} bigEndian {
    set x abcdef
    binary set x t* {65 66}
    binary encode hex $x
} 004100426566
test binary-89.3.BE {binary set: t} bigEndian {
    set x abcdef
    binary set x t2 {65 -66 67 68 69}
    binary encode hex $x
} 0041ffbe6566
test binary-89.1.LE {binary set: t} littleEndian {
    set x abcdef
    binary set x t 65
    binary encode hex $x
} 410063646566
test binary-89.2.LE {binary set: t} littleEndian {
    set x abcdef
    binary set x t* {65 66}
    binary encode hex $x
} 410042006566
test binary-89.3.LE {binary set: t} littleEndian {
    set x abcdef
    binary set x t2 {65 -66 67 68 69}
    binary encode hex $x
} 4100beff6566

test binary-90.1 {binary set: i} {
    set x abcdefghij
    binary set x i 65
    binary encode hex $x
} 4100000065666768696a
test binary-90.2 {binary set: i} {
    set x abcdefghij
    binary set x i* {65 66}
    binary encode hex $x
} 4100000042000000696a
test binary-90.3 {binary set: i} {
    set x abcdefghij
    binary set x i2 {65 -66 67 68 69}
    binary encode hex $x
} 41000000beffffff696a

test binary-91.1 {binary set: I} {
    set x abcdefghij
    binary set x I 65
    binary encode hex $x
} 0000004165666768696a
test binary-91.2 {binary set: I} {
    set x abcdefghij
    binary set x I* {65 66}
    binary encode hex $x
} 0000004100000042696a
test binary-91.3 {binary set: I} {
    set x abcdefghij
    binary set x I2 {65 -66 67 68 69}
    binary encode hex $x
} 00000041ffffffbe696a

test binary-92.1.BE {binary set: n} bigEndian {
    set x abcdefghij
    binary set x n 65
    binary encode hex $x
} 0000004165666768696a
test binary-92.2.BE {binary set: n} bigEndian {
    set x abcdefghij
    binary set x n* {65 66}
    binary encode hex $x
} 0000004100000042696a
test binary-92.3.BE {binary set: n} bigEndian {
    set x abcdefghij
    binary set x n2 {65 -66 67 68 69}
    binary encode hex $x
} 00000041ffffffbe696a
test binary-92.1.LE {binary set: n} littleEndian {
    set x abcdefghij
    binary set x n 65
    binary encode hex $x
} 4100000065666768696a
test binary-92.2.LE {binary set: n} littleEndian {
    set x abcdefghij
    binary set x n* {65 66}
    binary encode hex $x
} 4100000042000000696a
test binary-92.3.LE {binary set: n} littleEndian {
    set x abcdefghij
    binary set x n2 {65 -66 67 68 69}
    binary encode hex $x
} 41000000beffffff696a

test binary-93.1 {binary set: w} {
    set x abcdefghijklmnopqr
    binary set x w 65
    binary encode hex $x
} 4100000000000000696a6b6c6d6e6f707172
test binary-93.2 {binary set: w} {
    set x abcdefghijklmnopqr
    binary set x w* {65 66}
    binary encode hex $x
} 410000000000000042000000000000007172
test binary-93.3 {binary set: w} {
    set x abcdefghijklmnopqr
    binary set x w2 {65 -66 67 68 69}
    binary encode hex $x
} 4100000000000000beffffffffffffff7172

test binary-94.1 {binary set: W} {
    set x abcdefghijklmnopqr
    binary set x W 65
    binary encode hex $x
} 0000000000000041696a6b6c6d6e6f707172
test binary-94.2 {binary set: W} {
    set x abcdefghijklmnopqr
    binary set x W* {65 66}
    binary encode hex $x
} 000000000000004100000000000000427172
test binary-94.3 {binary set: W} {
    set x abcdefghijklmnopqr
    binary set x W2 {65 -66 67 68 69}
    binary encode hex $x
} 0000000000000041ffffffffffffffbe7172

test binary-95.1.BE {binary set: m} bigEndian {
    set x abcdefghijklmnopqr
    binary set x m 65
    binary encode hex $x
} 0000000000000041696a6b6c6d6e6f707172
test binary-95.2.BE {binary set: m} bigEndian {
    set x abcdefghijklmnopqr
    binary set x m* {65 66}
    binary encode hex $x
} 000000000000004100000000000000427172
test binary-95.3.BE {binary set: m} bigEndian {
    set x abcdefghijklmnopqr
    binary set x m2 {65 -66 67 68 69}
    binary encode hex $x
} 0000000000000041ffffffffffffffbe7172
test binary-95.1.LE {binary set: m} littleEndian {
    set x abcdefghijklmnopqr
    binary set x m 65
    binary encode hex $x
} 4100000000000000696a6b6c6d6e6f707172
test binary-95.2.LE {binary set: m} littleEndian {
    set x abcdefghijklmnopqr
    binary set x m* {65 66}
    binary encode hex $x
} 410000000000000042000000000000007172
test binary-95.3.LE {binary set: m} littleEndian {
    set x abcdefghijklmnopqr
    binary set x m2 {65 -66 67 68 69}
    binary encode hex $x
} 4100000000000000beffffffffffffff7172

test binary-96.1 {binary set: r} {
    set x abcdefghij
    binary set x r 65.3
    binary encode hex $x
} 9a99824265666768696a
test binary-96.2 {binary set: r} {
    set x abcdefghij
    binary set x r* {65.3 66.6}
    binary encode hex $x
} 9a99824233338542696a
test binary-96.3 {binary set: r} {
    set x abcdefghij
    binary set x r2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 9a998242333385c2696a

test binary-97.1 {binary set: R} {
    set x abcdefghij
    binary set x R 65.3
    binary encode hex $x
} 4282999a65666768696a
test binary-97.2 {binary set: R} {
    set x abcdefghij
    binary set x R* {65.3 66.6}
    binary encode hex $x
} 4282999a42853333696a
test binary-97.3 {binary set: R} {
    set x abcdefghij
    binary set x R2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 4282999ac2853333696a

test binary-98.1.BE {binary set: f} bigEndian {
    set x abcdefghij
    binary set x f 65.3
    binary encode hex $x
} 4282999a65666768696a
test binary-98.2.BE {binary set: f} bigEndian {
    set x abcdefghij
    binary set x f* {65.3 66.6}
    binary encode hex $x
} 4282999a42853333696a
test binary-98.3.BE {binary set: f} bigEndian {
    set x abcdefghij
    binary set x f2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 4282999ac2853333696a
test binary-98.1.LE {binary set: f} littleEndian {
    set x abcdefghij
    binary set x f 65.3
    binary encode hex $x
} 9a99824265666768696a
test binary-98.2.LE {binary set: f} littleEndian {
    set x abcdefghij
    binary set x f* {65.3 66.6}
    binary encode hex $x
} 9a99824233338542696a
test binary-98.3.LE {binary set: f} littleEndian {
    set x abcdefghij
    binary set x f2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 9a998242333385c2696a

test binary-99.1 {binary set: q} {
    set x abcdefghijklmnopqr
    binary set x q 65.3
    binary encode hex $x
} 3333333333535040696a6b6c6d6e6f707172
test binary-99.2 {binary set: q} {
    set x abcdefghijklmnopqr
    binary set x q* {65.3 66.6}
    binary encode hex $x
} 33333333335350406666666666a650407172
test binary-99.3 {binary set: q} {
    set x abcdefghijklmnopqr
    binary set x q2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 33333333335350406666666666a650c07172

test binary-100.1 {binary set: Q} {
    set x abcdefghijklmnopqr
    binary set x Q 65.3
    binary encode hex $x
} 4050533333333333696a6b6c6d6e6f707172
test binary-100.2 {binary set: Q} {
    set x abcdefghijklmnopqr
    binary set x Q* {65.3 66.6}
    binary encode hex $x
} 40505333333333334050a666666666667172
test binary-100.3 {binary set: Q} {
    set x abcdefghijklmnopqr
    binary set x Q2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 4050533333333333c050a666666666667172

test binary-101.1.BE {binary set: d} bigEndian {
    set x abcdefghijklmnopqr
    binary set x d 65.3
    binary encode hex $x
} 4050533333333333696a6b6c6d6e6f707172
test binary-101.2.BE {binary set: d} bigEndian {
    set x abcdefghijklmnopqr
    binary set x d* {65.3 66.6}
    binary encode hex $x
} 40505333333333334050a666666666667172
test binary-101.3.BE {binary set: d} bigEndian {
    set x abcdefghijklmnopqr
    binary set x d2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 4050533333333333c050a666666666667172
test binary-101.1.LE {binary set: d} littleEndian {
    set x abcdefghijklmnopqr
    binary set x d 65.3
    binary encode hex $x
} 3333333333535040696a6b6c6d6e6f707172
test binary-101.2.LE {binary set: d} littleEndian {
    set x abcdefghijklmnopqr
    binary set x d* {65.3 66.6}
    binary encode hex $x
} 33333333335350406666666666a650407172
test binary-101.3.LE {binary set: d} littleEndian {
    set x abcdefghijklmnopqr
    binary set x d2 {65.3 -66.6 67.1 68.8 69.2}
    binary encode hex $x
} 33333333335350406666666666a650c07172

test binary-102.1 {binary set: x} {
    set x abc
    binary set x x
    binary encode hex $x
} 006263
test binary-102.2 {binary set: x} {
    set x abc
    binary set x x2
    binary encode hex $x
} 000063

test binary-103.1 {binary set: X} {
    set x abcdef
    binary set x a2Xa AB Z
    binary encode hex $x
} 415a63646566
test binary-103.2 {binary set: X} {
    set x abcdef
    binary set x a4X2a ABCD Z
    binary encode hex $x
} 41425a446566
test binary-103.3 {binary set: X} {
    set x abcdef
    binary set x a2X4a ABCD Z
    binary encode hex $x
} 5a4263646566
test binary-103.4 {binary set: X} {
    set x abcdef
    binary set x a2X*a ABCD Z
    binary encode hex $x
} 5a4263646566

test binary-104.1 {binary set: @} {
    set x abcdef
    binary set x [email protected] ABCD Z
    binary encode hex $x
} 41425a446566
test binary-104.2 {binary set: @} {
    set x abcdef
    binary set x [email protected] ABCD Z
    binary encode hex $x
} 414263645a66
test binary-104.3 {binary set: @} {
    set x abcdef
    binary set x [email protected]*a ABCD Z
    binary encode hex $x
} 4142636465665a
 
# ----------------------------------------------------------------------
# cleanup

::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# End: