This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
display = Calculator.display("123+45-67*8") | |
assert display == "8" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// BEFORE | |
return 2 | |
// AFTER | |
return 1 + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Copy() { | |
CopyV2(&ReadKeyboard, &WritePrinter); | |
} | |
void CopyV2(int (*fnRead)(void), void (*fnWrite)(int)) { | |
int c; | |
while ((c = (*fnRead)() != EOF) | |
(*fnWrite)(c); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Copy() { | |
int (*fnRead)(void) = &ReadKeyboard; | |
void (*fnWrite)(int) = &WritePrinter; | |
int c; | |
while ((c = (*fnRead)() != EOF) | |
(*fnWrite)(c); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Copy() { | |
int c; | |
while ((c = ReadKeyboard()) != EOF) | |
WritePrinter(c); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoreMonitorTest { | |
@Test | |
public void alertSentWhenProductNeedsReordering() { | |
verify(alert).send(product); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def row(line): | |
return 44 | |
def column(line): | |
return 5 | |
def location(line): | |
line.rstrip() | |
return row(line), column(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sut(lines): | |
seat_ids = [357] | |
return max(seat_ids) | |
lines = ["FBFBBFFRLR\n"] | |
answer = sut(lines) | |
assert 357 == answer |
NewerOlder