每次运行EarlGrey测试时,都会失败并显示以下消息:
由于错误而无法更改设备方向:#include <stdio.h>
int Add (int x, int y);
long long Booth (int x, int y);
int main() {
int hex1, hex2;
long long product;
printf("\nEnter Multiplicand & Multiplier in hex: ");
scanf(" %x %x", &hex1, &hex2);
product = Booth(hex1, hex2);
printf("Multiplicand = 0x%08X \tAs signed = %+d\n", hex1, hex1);
printf("Multiplier = 0x%08X \tAs signed = %+d\n", hex2, hex2);
printf("Product = 0x%16X \tAs signed = %+d\n", product, product);
}
int Add (int x, int y) {
return x + y;
}
long long Booth (int multiplicand, int multiplier) {
int i;
long long product;
long long productLH;
long long productRH;
int productLHI;
int productRHI;
int cOut;
int negMultiplicand;
negMultiplicand = Add (~multiplicand, 1);
product = (long long) Add (0, multiplier);
for (i = 0; i < 32; i++) {
if (((product & 1) == 1) && (cOut == 0)) {
//Mask left half and right half of product
productLH = (product & 0xFFFFFFFF00000000);
productRH = (product & 0x00000000FFFFFFFF);
//Bit shift product so all values are in lower 32 bits
productLH = (productLH >> 32);
//Convert left halves and right halves to ints
productLHI = (int) (productLH & 0x00000000FFFFFFFF);
productRHI = (int) productRH & (0x00000000FFFFFFFF);
productLHI = Add(productLHI, negMultiplicand);
//Put halves back together
product = (long long) Add(productLHI, 0);
product = ((product << 32) & 0xFFFFFFFFFFFFFFFF);
product = (long long) Add((int)product, productRHI);
}
else if (((product & 1) == 0) && (cOut == 1)) {
//Mask left half and right half of product
productLH = (product & 0xFFFFFFFF00000000);
productRH = (product & 0x00000000FFFFFFFF);
//Bit shift product so all values are in lower 32 bits
productLH = (productLH >> 32);
//Convert left halves and right halves to ints
productLHI = (int) (productLH & 0x00000000FFFFFFFF);
productRHI = (int) productRH & (0x00000000FFFFFFFF);
productLHI = Add(productLHI, multiplicand);
//Put halves back together
product = (long long) Add(productLHI, 0);
product = ((product << 32) & 0xFFFFFFFFFFFFFFFF);
product = (long long) Add((int)product, productRHI);
}
cOut = (product & 1);
product = product >> 1;
}
return product;
}
也许动画或网络请求无限期地持续进行?
等待终端事件给我一个问题。所有元素的完整状态转换调用堆栈:
Error Domain=com.google.earlgrey.GREYUIThreadExecutorErrorDomain Code=0 "Failed to execute block because App is not idle.
答案 0 :(得分:2)
当用于管理视图的外观和消失的方法未正确调用或以正确的顺序调用时,可能会发生这种情况。查看超时故障消息中的状态转换堆栈跟踪,以查看每个视图控制器的状态。您可以使用此信息来确定哪个视图控制器覆盖viewWillAppear
或viewDidAppear
方法,但是缺少对超级调用的调用。 EarlGrey
使用视图生命周期调用来跟踪应用程序的状态以进行同步。