summaryrefslogtreecommitdiff
path: root/yaksh/documentation
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2020-04-07 14:26:08 +0530
committerGitHub2020-04-07 14:26:08 +0530
commit12af42a922679a33ce52df24499e165474fbd7d2 (patch)
tree2b9cc30e63525289fbd1927706be442565cdac93 /yaksh/documentation
parent7886d4f3ce672a80f3284aba17840b64cf6b19a4 (diff)
parent4d56ce652b4b512080854191aae2925658a1c687 (diff)
downloadonline_test-12af42a922679a33ce52df24499e165474fbd7d2.tar.gz
online_test-12af42a922679a33ce52df24499e165474fbd7d2.tar.bz2
online_test-12af42a922679a33ce52df24499e165474fbd7d2.zip
Merge pull request #686 from adityacp/add_r_info_docs
Add R language standard testcase information in documentation
Diffstat (limited to 'yaksh/documentation')
-rw-r--r--yaksh/documentation/images/r_standard_testcase.jpgbin0 -> 42217 bytes
-rw-r--r--yaksh/documentation/moderator_docs/creating_question.rst37
2 files changed, 37 insertions, 0 deletions
diff --git a/yaksh/documentation/images/r_standard_testcase.jpg b/yaksh/documentation/images/r_standard_testcase.jpg
new file mode 100644
index 0000000..db6bf9b
--- /dev/null
+++ b/yaksh/documentation/images/r_standard_testcase.jpg
Binary files differ
diff --git a/yaksh/documentation/moderator_docs/creating_question.rst b/yaksh/documentation/moderator_docs/creating_question.rst
index 2c52628..ea2d610 100644
--- a/yaksh/documentation/moderator_docs/creating_question.rst
+++ b/yaksh/documentation/moderator_docs/creating_question.rst
@@ -244,6 +244,43 @@ How to write Test cases
c=a+b;
endfunction
+ * **For R**
+ .. image:: ../images/r_standard_testcase.jpg
+ :width: 80%
+
+ Consider a Program to print even or odd number.
+ The code in the Test case Field should be as follows: ::
+
+ source("function.r")
+ check_empty = function(obj){
+ stopifnot(is.null(obj) == FALSE)
+ }
+ check = function(input, output){
+ stopifnot(input == output)
+ }
+ is_correct = function(){
+ if (count == 3){
+ quit("no", 31)
+ }
+ }
+ check_empty(odd_or_even(3))
+ check(odd_or_even(6), "EVEN")
+ check(odd_or_even(1), "ODD")
+ check(odd_or_even(10), "EVEN")
+ check(odd_or_even(777), "ODD")
+ check(odd_or_even(778), "EVEN")
+ count = 3
+ is_correct()
+
+ Assuming Students answer to be as below: ::
+
+ odd_or_even <- function(n){
+ if(n %% 2 == 0){
+ return("EVEN")
+ }
+ return("ODD")
+ }
+
Check **Delete** Field if a test case is to be removed.