@@ -349,27 +349,9 @@
|
||||
"max_one_statement": true,
|
||||
"message_exists": true,
|
||||
"method_implemented_twice": true,
|
||||
"method_length": {
|
||||
"exclude": [],
|
||||
"severity": "Error",
|
||||
"statements": 100,
|
||||
"errorWhenEmpty": true,
|
||||
"ignoreTestClasses": false,
|
||||
"checkForms": true
|
||||
},
|
||||
"method_length": false,
|
||||
"method_overwrites_builtin": true,
|
||||
"method_parameter_names": {
|
||||
"exclude": [],
|
||||
"severity": "Error",
|
||||
"patternKind": "required",
|
||||
"ignoreNames": [],
|
||||
"ignorePatterns": [],
|
||||
"ignoreExceptions": true,
|
||||
"importing": "^I._.+$",
|
||||
"returning": "^R._.+$",
|
||||
"changing": "^C._.+$",
|
||||
"exporting": "^E._.+$"
|
||||
},
|
||||
"method_parameter_names": false,
|
||||
"mix_returning": true,
|
||||
"modify_only_own_db_tables": {
|
||||
"exclude": [],
|
||||
@@ -550,11 +532,7 @@
|
||||
"severity": "Error",
|
||||
"skipNames": []
|
||||
},
|
||||
"unused_variables": {
|
||||
"exclude": [],
|
||||
"severity": "Error",
|
||||
"skipNames": []
|
||||
},
|
||||
"unused_variables": false,
|
||||
"use_bool_expression": true,
|
||||
"use_class_based_exceptions": true,
|
||||
"use_line_exists": true,
|
||||
|
||||
@@ -349,27 +349,9 @@
|
||||
"max_one_statement": true,
|
||||
"message_exists": true,
|
||||
"method_implemented_twice": true,
|
||||
"method_length": {
|
||||
"exclude": [],
|
||||
"severity": "Error",
|
||||
"statements": 100,
|
||||
"errorWhenEmpty": true,
|
||||
"ignoreTestClasses": false,
|
||||
"checkForms": true
|
||||
},
|
||||
"method_length": false,
|
||||
"method_overwrites_builtin": true,
|
||||
"method_parameter_names": {
|
||||
"exclude": [],
|
||||
"severity": "Error",
|
||||
"patternKind": "required",
|
||||
"ignoreNames": [],
|
||||
"ignorePatterns": [],
|
||||
"ignoreExceptions": true,
|
||||
"importing": "^I._.+$",
|
||||
"returning": "^R._.+$",
|
||||
"changing": "^C._.+$",
|
||||
"exporting": "^E._.+$"
|
||||
},
|
||||
"method_parameter_names": false,
|
||||
"mix_returning": true,
|
||||
"modify_only_own_db_tables": {
|
||||
"exclude": [],
|
||||
|
||||
@@ -28,6 +28,14 @@
|
||||
"practices": [],
|
||||
"prerequisites": [],
|
||||
"difficulty": 1
|
||||
},
|
||||
{
|
||||
"slug": "two-fer",
|
||||
"name": "Two Fer",
|
||||
"uuid": "4606da73-f376-409e-8526-f95bec03643b",
|
||||
"practices": [],
|
||||
"prerequisites": [],
|
||||
"difficulty": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
26
exercises/practice/two-fer/.docs/instructions.md
Normal file
26
exercises/practice/two-fer/.docs/instructions.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Description
|
||||
|
||||
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
||||
|
||||
Given a name, return a string with the message:
|
||||
|
||||
```text
|
||||
One for name, one for me.
|
||||
```
|
||||
|
||||
Where "name" is the given name.
|
||||
|
||||
However, if the name is missing, return the string:
|
||||
|
||||
```text
|
||||
One for you, one for me.
|
||||
```
|
||||
|
||||
Here are some examples:
|
||||
|
||||
|Name |String to return
|
||||
|:-------|:------------------
|
||||
|Alice |One for Alice, one for me.
|
||||
|Bob |One for Bob, one for me.
|
||||
| |One for you, one for me.
|
||||
|Zaphod |One for Zaphod, one for me.
|
||||
12
exercises/practice/two-fer/.meta/config.json
Normal file
12
exercises/practice/two-fer/.meta/config.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"blurb": "Create a sentence of the form \"One for X, one for me.\".",
|
||||
"authors": ["larshp"],
|
||||
"contributors": [
|
||||
],
|
||||
"files": {
|
||||
"solution": ["zcl_two_fer.clas.abap"],
|
||||
"test": ["zcl_two_fer.clas.testclasses.abap"],
|
||||
"example": [".meta/zcl_two_fer.clas.abap"]
|
||||
},
|
||||
"source_url": "https://github.com/exercism/problem-specifications/issues/757"
|
||||
}
|
||||
20
exercises/practice/two-fer/.meta/zcl_two_fer.clas.abap
Normal file
20
exercises/practice/two-fer/.meta/zcl_two_fer.clas.abap
Normal file
@@ -0,0 +1,20 @@
|
||||
CLASS zcl_two_fer DEFINITION PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS two_fer
|
||||
IMPORTING
|
||||
input TYPE string OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS zcl_two_fer IMPLEMENTATION.
|
||||
|
||||
METHOD two_fer.
|
||||
DATA(name) = input.
|
||||
IF name IS INITIAL.
|
||||
name = 'you'.
|
||||
ENDIF.
|
||||
result = |One for { name }, one for me.|.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
16
exercises/practice/two-fer/zcl_two_fer.clas.abap
Normal file
16
exercises/practice/two-fer/zcl_two_fer.clas.abap
Normal file
@@ -0,0 +1,16 @@
|
||||
CLASS zcl_two_fer DEFINITION PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
METHODS two_fer
|
||||
IMPORTING
|
||||
input TYPE string OPTIONAL
|
||||
RETURNING
|
||||
VALUE(result) TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS zcl_two_fer IMPLEMENTATION.
|
||||
|
||||
METHOD two_fer.
|
||||
* add solution here
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
36
exercises/practice/two-fer/zcl_two_fer.clas.testclasses.abap
Normal file
36
exercises/practice/two-fer/zcl_two_fer.clas.testclasses.abap
Normal file
@@ -0,0 +1,36 @@
|
||||
CLASS ltcl_two_fer DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA cut TYPE REF TO zcl_two_fer.
|
||||
METHODS setup.
|
||||
METHODS test_empty FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_alice FOR TESTING RAISING cx_static_check.
|
||||
METHODS test_bob FOR TESTING RAISING cx_static_check.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltcl_two_fer IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
cut = NEW zcl_two_fer( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_empty.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = cut->two_fer( )
|
||||
exp = 'One for you, one for me.' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_alice.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = cut->two_fer( 'Alice' )
|
||||
exp = 'One for Alice, one for me.' ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD test_bob.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = cut->two_fer( 'Bob' )
|
||||
exp = 'One for Bob, one for me.' ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user