|
|
преди 9 години | |
|---|---|---|
| .. | ||
| .meta | преди 9 години | |
| src | преди 9 години | |
| HINTS.md | преди 9 години | |
| README.md | преди 9 години | |
| build.gradle | преди 9 години | |
Two-fer or 2-fer is short for two for one. One for you and one for me.
"One for X, one for me."
When X is a name or "you".
If the given name is "Alice", the result should be "One for Alice, one for me." If no name is given, the result should be "One for you, one for me."
As programmers mature, they eventually want to test their code.
Here at Exercism we simulate Test-Driven Development (TDD), where you write your tests before writing any functionality. The simulation comes in the form of a pre-written test suite, which will signal that you have solved the problem.
It will also provide you with a safety net to explore other solutions without breaking the functionality.
exercism submit /path/to/file)Submissions are encouraged to be general, within reason. Having said that, it's also important not to over-engineer a solution.
It's important to remember that the goal is to make code as expressive and readable as we can.
Most Java exercises include multiple test cases. These cases are structured to support a useful process known as test-driven development (TDD). TDD involves repeating a structured cycle that helps programmers build complex functionality piece by piece rather than all at once. That cycle can be described as follows:
The test files in this track contain all the tests your solution should pass to be considered valid. That doesn't immediately seem to be compatible with the cycle described above, in which tests are written one by one. However, the tool that we use to write our tests, JUnit, provides an @Ignore annotation that can be used to temporarily skip an already-written test. Using this annotation, we make sure that the test files we deliver to you satisfy the following rules:
This allows you to simulate the TDD cycle by following these slightly-modified steps:
@Ignore annotation in the test file.To run the tests:
$ gradle test
For more detailed info about the Java track see the help page.
This is an exercise to introduce users to basic programming constructs, just after hello World. https://en.wikipedia.org/wiki/Two-fer
It's possible to submit an incomplete solution so you can see how others have completed the exercise.