mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
25 lines
502 B
Plaintext
25 lines
502 B
Plaintext
// #target: macos-x64
|
|
module testing;
|
|
import std::io;
|
|
|
|
fn void main()
|
|
{
|
|
String[] s1;
|
|
String[] s2;
|
|
deep_equal(s1, s2);
|
|
}
|
|
|
|
macro bool deep_equal(a, b)
|
|
{
|
|
$switch ($typeof(a).kindof)
|
|
$case SLICE:
|
|
if (a.len != b.len) return false;
|
|
foreach (i, x : a)
|
|
{
|
|
if (!deep_equal(x, b[i])) return false;
|
|
}
|
|
return true;
|
|
$default:
|
|
$assert(false); // #error: Compile time assert failed
|
|
$endswitch
|
|
} |