mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user