Skip to content

Instantly share code, notes, and snippets.

display = Calculator.display("123+45-67*8")
assert display == "8"
// BEFORE
return 2
// AFTER
return 1 + 1
void Copy() {
CopyV2(&ReadKeyboard, &WritePrinter);
}
void CopyV2(int (*fnRead)(void), void (*fnWrite)(int)) {
int c;
while ((c = (*fnRead)() != EOF)
(*fnWrite)(c);
}
void Copy() {
int (*fnRead)(void) = &ReadKeyboard;
void (*fnWrite)(int) = &WritePrinter;
int c;
while ((c = (*fnRead)() != EOF)
(*fnWrite)(c);
}
void Copy() {
int c;
while ((c = ReadKeyboard()) != EOF)
WritePrinter(c);
}
public class StoreMonitorTest {
@Test
public void alertSentWhenProductNeedsReordering() {
Alert alert = mock(Alert.class);
Product product = new Product(811, 11, 14);
{ //
alert.send(product);
} //
verify(alert).send(product);
}
public class StoreMonitorTest {
@Test
public void alertSentWhenProductNeedsReordering() {
Alert alert = mock(Alert.class);
Product product = new Product(811, 11, 14);
{ //
// TODO: the magic happens here.
} //
verify(alert).send(product);
}
class StoreMonitorTest {
@Test
public void alertSentWhenProductNeedsReordering() {
verify(alert).send(product);
}
}
def row(line):
return 44
def column(line):
return 5
def location(line):
line.rstrip()
return row(line), column(line)
def sut(lines):
seat_ids = [357]
return max(seat_ids)
lines = ["FBFBBFFRLR\n"]
answer = sut(lines)
assert 357 == answer