z3 0.0.20181126 → 0.0.20181229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/z3/ast.rb +8 -0
- data/spec/expr_spec.rb +62 -0
- 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: b88561867f390fe0aa80a1744d15f5daf65e018e3eec21c659aaaa4747a33774
|
4
|
+
data.tar.gz: 8b78a9f60131dcf2f3945894ea1e5e418910729ebae07868e3447713529e71a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c8908ad9bb03adce26c2ab5b10a32fb651cc0c970f3f3c346c4b9a7db98eafd839a313875bee213f5d0caef29c0fea5f09f234765bb0150fd0da2a04ee33fd
|
7
|
+
data.tar.gz: d6385ee4215aee32b4bc50b427f48afed7efdc8637c0ffd6d4ccd4af8345d41acc9d4beae79f3ccf7bb9408b6fad527af430e87c32c1a9fc28c402be97cb19b5
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ You can use most Ruby operators to construct Z3 expressions, but use `| &` inste
|
|
12
12
|
|
13
13
|
The interface is potentially unstable, and can change in the future.
|
14
14
|
|
15
|
-
`Z3::
|
15
|
+
`Z3::VeryLowLevel` and `Z3::LowLevel` are FFI interfaces for internal use, and they shouldn't be used directly. Also don't use any method starting with `_`. Doing this is likely to lead to segmentation faults unless extreme care is taken.
|
16
16
|
|
17
17
|
A utility at `api/gen_api` will loop through a .h file and generate Ruby definitions. This will update the API when upstream changes `z3_api.h`
|
18
18
|
|
data/lib/z3/ast.rb
CHANGED
data/spec/expr_spec.rb
CHANGED
@@ -183,4 +183,66 @@ module Z3
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
186
|
+
|
187
|
+
describe "#hash / #eql?" do
|
188
|
+
let(:x1) { Z3.Int("x") }
|
189
|
+
let(:x2) { Z3.Int("x") }
|
190
|
+
let(:y1) { Z3.Int("y") }
|
191
|
+
let(:y2) { Z3.Int("y") }
|
192
|
+
let(:e1) { x1 + y1 }
|
193
|
+
let(:e2) { x2 + y2 }
|
194
|
+
let(:f1) { y1 + x1 }
|
195
|
+
let(:f2) { y2 + x2 }
|
196
|
+
let(:samples) { [x1, x2, y1, y2, e1, e2, f1, f2] }
|
197
|
+
|
198
|
+
it "object is eql? to itself" do
|
199
|
+
expect(x1.eql?(x1)).to be true
|
200
|
+
expect(y1.eql?(y1)).to be true
|
201
|
+
expect(e1.eql?(e1)).to be true
|
202
|
+
|
203
|
+
expect(x1.eql?(y1)).to be false
|
204
|
+
expect(x1.eql?(e1)).to be false
|
205
|
+
end
|
206
|
+
|
207
|
+
it "object is eql? to structurally identical object" do
|
208
|
+
expect(x1.eql?(x2)).to be true
|
209
|
+
expect(y1.eql?(y2)).to be true
|
210
|
+
expect(e1.eql?(e2)).to be true
|
211
|
+
expect(f1.eql?(f2)).to be true
|
212
|
+
end
|
213
|
+
|
214
|
+
it "object is not eql? to semantically identical object" do
|
215
|
+
expect(e1.eql?(f1)).to be false
|
216
|
+
end
|
217
|
+
|
218
|
+
it "#hash aligns with #eql?" do
|
219
|
+
samples.each do |a|
|
220
|
+
samples.each do |b|
|
221
|
+
if a.eql?(b)
|
222
|
+
expect(a.hash).to eq(b.hash)
|
223
|
+
else
|
224
|
+
expect(a.hash).to_not eq(b.hash)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
it "works when used as Hash keys" do
|
231
|
+
ht = {}
|
232
|
+
ht[x1] = 1
|
233
|
+
ht[y1] = 2
|
234
|
+
ht[e1] = 3
|
235
|
+
ht[e2] = 4
|
236
|
+
|
237
|
+
expect(ht.size).to eq(3)
|
238
|
+
expect(ht[x1]).to eq(1)
|
239
|
+
expect(ht[x2]).to eq(1)
|
240
|
+
expect(ht[y1]).to eq(2)
|
241
|
+
expect(ht[y2]).to eq(2)
|
242
|
+
expect(ht[e1]).to eq(4)
|
243
|
+
expect(ht[e2]).to eq(4)
|
244
|
+
expect(ht[f1]).to eq(nil)
|
245
|
+
expect(ht[f2]).to eq(nil)
|
246
|
+
end
|
247
|
+
end
|
186
248
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: z3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20181229
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Wegrzanowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|