Skip to content

Commit

Permalink
Update float->number and int->i64
Browse files Browse the repository at this point in the history
  • Loading branch information
fizruk committed Dec 9, 2024
1 parent 4229ecf commit efd5b4b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions eo-phi-normalizer/src/Language/EO/Phi/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ desugarBinding = \case
-- MetaSubstThis

wrapBytesInInt :: Bytes -> Object
wrapBytesInInt (Bytes bytes) = [fmt|Φ.org.eolang.int(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|]
wrapBytesInInt (Bytes bytes) = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|]
wrapBytesInFloat :: Bytes -> Object
wrapBytesInFloat (Bytes bytes) = [fmt|Φ.org.eolang.number(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bytes}))|]
wrapBytesInString :: Bytes -> Object
Expand All @@ -128,8 +128,8 @@ wrapTermination = [fmt|Φ.org.eolang.error(α0 ↦ Φ.org.eolang.string(as-bytes

wrapBytesInConstInt :: Bytes -> Object
wrapBytesInConstInt bytes@(Bytes bs)
| n < 0 = [fmt|Φ.org.eolang.int(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|]
| otherwise = [fmt|Φ.org.eolang.int(as-bytes ↦ {n})|]
| n < 0 = [fmt|Φ.org.eolang.i64(as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ {bs}))|]
| otherwise = [fmt|Φ.org.eolang.i64(as-bytes ↦ {n})|]
where
n = bytesToInt bytes

Expand Down
80 changes: 40 additions & 40 deletions eo-phi-normalizer/test/eo/phi/dataization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ title: Dataization tests
tests:
- name: "Celsius example"
dependencies:
- ./data/0.38.0/org/eolang/float.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/number.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
c ↦ Φ.org.eolang.float(
c ↦ Φ.org.eolang.number(
as-bytes ↦ Φ.org.eolang.bytes(Δ ⤍ 40-39-00-00-00-00-00-00)
), // 25.0
φ ↦ ξ.c.times(x ↦ ⟦ Δ ⤍ 3F-FC-CC-CC-CC-CC-CC-CD ⟧) // 1.8
Expand All @@ -39,9 +39,9 @@ tests:

- name: "Equality of booleans (via equality of bytes)"
dependencies:
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.38.0/org/eolang/true.phi
- ./data/0.38.0/org/eolang/false.phi
- ./data/0.41.2/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/true.phi
- ./data/0.41.2/org/eolang/false.phi
input: |
{⟦ φ ↦ Φ.org.eolang.true.eq(α0 ↦ Φ.org.eolang.true) ⟧}
output:
Expand Down Expand Up @@ -232,7 +232,7 @@ tests:

- name: "Dataize in siblings of Package"
dependencies:
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
org ↦ ⟦
Expand Down Expand Up @@ -275,8 +275,8 @@ tests:
- name: "int times and plus"
dependencies:
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -294,10 +294,10 @@ tests:

- name: "int greater than"
dependencies:
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.38.0/org/eolang/false.phi
- ./data/0.38.0/org/eolang/true.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/false.phi
- ./data/0.41.2/org/eolang/true.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -313,7 +313,7 @@ tests:

- name: "bitwise and"
dependencies:
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -327,7 +327,7 @@ tests:

- name: "bitwise not"
dependencies:
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -340,8 +340,8 @@ tests:

- name: "bytes size"
dependencies:
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -354,10 +354,10 @@ tests:

- name: "bytes shift and equal"
dependencies:
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.38.0/org/eolang/true.phi
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/false.phi
- ./data/0.41.2/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/true.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/false.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -377,37 +377,37 @@ tests:

- name: "float times and plus (raw bytes)"
dependencies:
- ./data/0.38.0/org/eolang/float.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/number.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
x ↦ ⟦
x ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧, // == 5.0
ρ ↦ ⟦ Δ ⤍ 40-2A-66-66-66-66-66-66 ⟧, // == 13.2
λ ⤍ Lorg_eolang_float_times
λ ⤍ Lorg_eolang_number_times
⟧,
ρ ↦ ⟦ Δ ⤍ 40-0B-5C-28-F5-C2-8F-5C ⟧, // == 3.42
λ ⤍ Lorg_eolang_float_plus
λ ⤍ Lorg_eolang_number_plus
⟧}
output:
object: "69.42"

- name: "float times and plus"
dependencies:
- ./data/0.38.0/org/eolang/float.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/number.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
x ↦ ⟦
x ↦ 5.0,
ρ ↦ 13.2,
λ ⤍ Lorg_eolang_float_times
λ ⤍ Lorg_eolang_number_times
⟧,
ρ ↦ 3.42,
λ ⤍ Lorg_eolang_float_plus
λ ⤍ Lorg_eolang_number_plus
⟧}
output:
Expand All @@ -417,8 +417,8 @@ tests:

- name: "string slice (raw bytes)"
dependencies:
- ./data/0.38.0/org/eolang/string.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/string.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -433,9 +433,9 @@ tests:

- name: "string slice"
dependencies:
- ./data/0.38.0/org/eolang/string.phi
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/string.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -450,9 +450,9 @@ tests:

- name: "string length (raw bytes)"
dependencies:
- ./data/0.38.0/org/eolang/string.phi
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/string.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand All @@ -465,9 +465,9 @@ tests:

- name: "string length"
dependencies:
- ./data/0.38.0/org/eolang/string.phi
- ./data/0.38.0/org/eolang/int.phi
- ./data/0.38.0/org/eolang/bytes.phi
- ./data/0.41.2/org/eolang/string.phi
- ./data/0.41.2/org/eolang/i64.phi
- ./data/0.41.2/org/eolang/bytes.phi
input: |
{⟦
φ ↦ ⟦
Expand Down

0 comments on commit efd5b4b

Please sign in to comment.