google / google/xls

Improve mismatch message in assert_eq for arrays

Open
#1,521 1 comment 0 reactions 0 assignees View on GitHub
dslx enhancement testing
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

### What's hard to do? (limit 100 words)

The change at https://github.com/google/xls/commit/f530b769e765910ac6251e403ab449fda4c6ec00 has been very useful. However, I noticed that it does not apply to array elements when comparing arrays.

E.g.

```
assert_eq(
some_fn(...),
u32[4]:[u32:0x75312468, u32:0, ...]);
```

might spit out something like:

```
FailureError: The program being interpreted failed!
lhs and rhs were not equal:
[
< u32:960064620,
> u32:1966154856,
u32:0,
u32:0,
u32:0
]
; first differing index: 0 :: 960064620 vs 1966154856
```

It would be nice if the change to use the literal base could apply to each array element as in the scalar case.

### Current best alternative workaround (limit 100 words)

Open up a Python interpreter (or some online base converter) to convert the decimal values to the form in the original test.

### Your view of the "best case XLS enhancement" (limit 100 words)

If the previous change could be extended to array elements, that would be great.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.