cddl 0.12.4 → 0.12.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cddl.gemspec +1 -1
- data/lib/cddl.rb +19 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0165296a8cb6db3edb52eca36db6650700b336e9b56be7fb43441d6689e1000b'
|
4
|
+
data.tar.gz: 18774d6257ec95b81e3ba6abfc2d1abf982ce0f2d79f1a12298e3b59c0fd407d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c2bede49beaa2c5cfebad435573632aefe258ff460427e7fc5599e96c85039c913ab295fb0dba43baeba36acbb0e7b035cebbbe69e8d9ae3bb179a6cdf8a5c
|
7
|
+
data.tar.gz: be65be0e5c42a59203ca3956b5d89da5680df5dff1f8da6120f9bfaa28ac3a558e609655c68d4164e94fb87d40ccb3a832432a69e4c5eb3f0398b673b8ff38e5
|
data/cddl.gemspec
CHANGED
data/lib/cddl.rb
CHANGED
@@ -302,6 +302,12 @@ module CDDL
|
|
302
302
|
abnfb: Encoding::BINARY
|
303
303
|
}
|
304
304
|
|
305
|
+
def myfrand(exp)
|
306
|
+
exprange = 1 << exp
|
307
|
+
expoffset= exprange >> 1
|
308
|
+
(rand(2)*2-1) * rand() * 2.0**(rand(exprange)-expoffset)
|
309
|
+
end
|
310
|
+
|
305
311
|
def generate
|
306
312
|
@recursion = 0
|
307
313
|
generate1(rules)
|
@@ -446,15 +452,15 @@ module CDDL
|
|
446
452
|
when 0..19, 23, 32..255
|
447
453
|
CBOR::Simple.new(w2)
|
448
454
|
when 25
|
449
|
-
while !(hs = Half.encode_from_single_bytes([
|
455
|
+
while !(hs = Half.encode_from_single_bytes([myfrand(5)].pack("g")))
|
450
456
|
end
|
451
457
|
Half.decode(hs)
|
452
458
|
when 26
|
453
|
-
while (a = [
|
459
|
+
while (a = [myfrand(8)].pack("g").unpack("g").first).to_cbor.size != 5
|
454
460
|
end
|
455
461
|
a
|
456
462
|
when 27
|
457
|
-
while (a =
|
463
|
+
while (a = myfrand(11)).to_cbor.size != 9
|
458
464
|
end
|
459
465
|
a
|
460
466
|
else
|
@@ -1005,6 +1011,7 @@ module CDDL
|
|
1005
1011
|
end
|
1006
1012
|
|
1007
1013
|
OPERATORS = {lt: :<, le: :<=, gt: :>, ge: :>=, eq: :==, ne: :!=}
|
1014
|
+
OPERATORS_MATCH = {eq: true, ne: false}
|
1008
1015
|
FLOAT_AI_FROM_SIZE = {3 => 25, 5 => 26, 9 => 27}
|
1009
1016
|
|
1010
1017
|
def validate1(d, where)
|
@@ -1135,6 +1142,11 @@ module CDDL
|
|
1135
1142
|
ok, v, _vt = extract_value(control)
|
1136
1143
|
if ok
|
1137
1144
|
ann if d.send(op, v) rescue nil # XXX Focus ArgumentError
|
1145
|
+
else
|
1146
|
+
needs_to_match = OPERATORS_MATCH[conop]
|
1147
|
+
unless needs_to_match.nil?
|
1148
|
+
ann if !!validate1(d, control) == needs_to_match
|
1149
|
+
end
|
1138
1150
|
end
|
1139
1151
|
when :regexp
|
1140
1152
|
ann if (
|
@@ -1428,6 +1440,10 @@ module CDDL
|
|
1428
1440
|
else
|
1429
1441
|
[:type1]
|
1430
1442
|
end
|
1443
|
+
elsif s = ENV["CDDL_INVENT"]
|
1444
|
+
s = "_" if s == ""
|
1445
|
+
r = [:type1, [:text, "#{s}-#{name}"]]
|
1446
|
+
return r
|
1431
1447
|
end
|
1432
1448
|
end
|
1433
1449
|
if r
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cbor-diag
|