gpt4 book ai didi

c# - 为什么这些 ulong 数组不被认为是相等的?

转载 作者:太空宇宙 更新时间:2023-11-03 22:54:39 25 4
gpt4 key购买 nike

<分区>

考虑函数:

public static ulong[] productFib(ulong prod)
{
ulong fib1 = 0;
ulong fib2 = 1;

while ((fib1 * fib2) < prod)
{
ulong temp = fib1;
fib1 = fib2;
fib2 = temp + fib2;

}

return new ulong[] { fib1, fib2, 1 };
}

我正在研究一个 kata,其测试如下所示:

ulong[] r = new ulong[] { 55, 89, 1 };
Assert.AreEqual(r, Kata.productFib(4895));

在立即窗口中,我可以看到返回数组不仅是 ulong 类型的但具有我期望的 3 个元素,但 MSTest 失败:

Message: Assert.AreEqual failed. Expected:<System.UInt64[]>. Actual:<System.UInt64[]>.

测试断言或我的函数是否有问题会导致此测试失败?

谢谢

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com