提交 a689c472 编写于 作者: J Jesse Glick

More pleasant way to test bitsets.

上级 7f107174
......@@ -194,8 +194,18 @@ public class CronTabTest {
}
});
assertEquals(x.bits[0],1L<<59);
assertEquals(x.bits[1],1L<<8);
assertEquals("59;", bitset(x.bits[0]));
assertEquals("8;", bitset(x.bits[1]));
}
private static String bitset(long bits) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < 64; i++) {
if ((bits & 1L << i) != 0) {
b.append(i).append(';');
}
}
return b.toString();
}
@Test
......@@ -206,8 +216,8 @@ public class CronTabTest {
}
});
assertEquals(x.bits[0],1L<<1);
assertEquals(x.bits[1],1L<<6);
assertEquals("1;", bitset(x.bits[0]));
assertEquals("6;", bitset(x.bits[1]));
}
@Test public void hashedMinute() throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册