Pair and Triple Compare w/ Unit Tests (#2359)

* Pair and Triple Compare w/ Unit Tests
* scope creep myself by adding date-time eq op
* make Pair and Triple printable
* Update releasenotes. Restrict equals on tuples to when underlying type supports `==`. Remove unnecessary Time.eq.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Zack Puhl
2025-08-02 17:11:27 -04:00
committed by GitHub
parent e707190539
commit 2a47cc2ca9
7 changed files with 160 additions and 3 deletions

View File

@@ -112,6 +112,11 @@ fn TzDateTime TzDateTime.to_gmt_offset(self, int gmt_offset) {
return { dt, gmt_offset };
}
fn bool TzDateTime.eq(self, TzDateTime other) @operator(==) @inline
{
return self.to_gmt_offset(0).time == other.to_gmt_offset(0).time;
}
<*
@require day >= 1 && day < 32
@require hour >= 0 && hour < 24
@@ -257,3 +262,5 @@ fn Duration DateTime.diff_us(self, DateTime from) @operator(-)
{
return self.time.diff_us(from.time);
}
fn bool DateTime.eq(self, DateTime other) @operator(==) @inline => self.time == other.time;