Skip to content

Commit

Permalink
First Version
Browse files Browse the repository at this point in the history
  • Loading branch information
oduvan committed Dec 30, 2019
1 parent 2349bcc commit 55d37f7
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 59 deletions.
2 changes: 1 addition & 1 deletion autofill.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
checkio --domain py autofillrepo --py-function sum_two --js-function sumTwo .
checkio --domain py autofillrepo --py-function replace_first --js-function replaceFirst .
4 changes: 2 additions & 2 deletions editor/animation/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ requirejs(['ext_editor_io', 'jquery_190'],
var io = new extIO({
multipleArguments: true,
functions: {
python: 'sum_two',
js: 'sumTwo'
python: 'replace_first',
js: 'replaceFirst'
}
});
io.start();
Expand Down
18 changes: 10 additions & 8 deletions editor/initial_code/js_node
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
"use strict";

function sumTwo(a, b) {
// sums two passed arguments

function replaceFirst(a) {
// your code here
return 0;
return undefined;
}

var assert = require('assert');

if (!global.is_checking) {
console.log('Example:');
console.log(sumTwo(3, 2));
console.log(replaceFirst([1, 2, 3, 4]));

// These "asserts" are used for self-checking
assert.deepEqual(replaceFirst([1, 2, 3, 4]), [2, 3, 4, 1]);
assert.deepEqual(replaceFirst([1]), [1]);
assert.deepEqual(replaceFirst([]), []);

// These "asserts" are used for self-checking and not for an auto-testing
assert.equal(sumTwo(3, 2), 5);
assert.equal(sumTwo(5, 7), 12);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}

14 changes: 6 additions & 8 deletions editor/initial_code/python_3
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
def sum_two(a, b):
"""
sums two passed arguments
"""
def replace_first(a):
# your code here
return None


if __name__ == '__main__':
print("Example:")
print(sum_two(3, 2))
print(replace_first([1, 2, 3, 4]))

# These "asserts" are used for self-checking and not for an auto-testing
assert sum_two(3, 2) == 5, "First"
assert sum_two(5, 7) == 12, "Second"
assert replace_first([1, 2, 3, 4]) == [2, 3, 4, 1]
assert replace_first([1]) == [1]
assert replace_first([]) == []
print("Coding complete? Click 'Check' to earn cool rewards!")
Binary file modified info/media/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions info/media/example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 7 additions & 23 deletions info/task_description.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<!-- Describe task in general -->

<p>
Sum two passed ints
In a given array first element should become the last one. Empty array or array with only one element should stay the same
</p>

<p style="text-align: center;">
<img title="example" src="{{MEDIA}}example.png" alt="example" style="max-height: 83px"/>
</p>

<!-- Explain input and output values -->
<p>
<strong>Input: </strong> Two arguments. Both are ints.
<strong>Input: </strong> {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.
</p>

<p>
<strong>Output: </strong> Int.
<strong>Output: </strong> {% if interpreter.slug == "js-node" %}Array{% else %}Itarable{% endif %}.
</p>


Expand All @@ -25,28 +24,13 @@
</p>

{% if interpreter.slug == "js-node" %}
<pre class="brush: javascript">sumTwo(2, 3) == 5
sumTwo(5, 7) == 12
<pre class="brush: javascript">replaceFirst([1, 2, 3, 4]) == [2, 3, 4, 1]
replaceFirst([1]) == [1]
</pre>
{% else %}
<pre class="brush: python">sum_two(2, 3) == 5
sum_two(5, 7) == 12
<pre class="brush: python">replace_first([1, 2, 3, 4]) == [2, 3, 4, 1]
replace_first([1]) == [1]
</pre>
{% endif %}
</div>


<!-- Here you can explain how it can be used in development -->
<!-- The section is optional -->
<p class="for_info_only">

<strong>How it’s used: </strong>
<i>(math is used everywhere)</i>
</p>

<!-- Here you can explain some constraints for input-->
<!-- The section is optional -->
<p>
<strong>Precondition:</strong>
<i>both given ints should be between -1000 and 1000</i>
</p>
2 changes: 1 addition & 1 deletion info/task_short_description.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add short description
The first element should become the last one
4 changes: 2 additions & 2 deletions verification/referee.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
CheckiOReferee(
tests=TESTS,
function_name={
"python": "sum_two",
"js": "sumTwo"
"python": "replace_first",
"js": "replaceFirst"
},
cover_code={
'python-3': cover_codes.unwrap_args,
Expand Down
32 changes: 18 additions & 14 deletions verification/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@
TESTS = {
"Basics": [
{
"input": [3, 2],
"answer": 5,
"explanation": "3+2=?"
"input": [[1,2,3,4]],
"answer": [2,3,4,1],
},
{
"input": [5, 7],
"answer": 12,
"explanation": "5+7=?"
}
"input": [[1]],
"answer": [1],
},
{
"input": [[]],
"answer": [],
},
],
"Extra": [
{
"input": [6, 3],
"answer": 9,
"explanation": "6+3=?"
"input": [[10, 10]],
"answer": [10, 10],
},
{
"input": [6, 7],
"answer": 13,
"explanation": "6+7=?"
}
"input": [[1,2,2,2]],
"answer": [2,2,2,1],
},
{
"input": [[100]],
"answer": [100],
},
]
}

0 comments on commit 55d37f7

Please sign in to comment.