mirror of
https://github.com/chubin/cheat.sh.git
synced 2024-11-22 18:17:38 +03:00
updated tests
This commit is contained in:
parent
43e06193c3
commit
1c3bec6a7f
@ -1,10 +1,12 @@
|
||||
1_Inheritance
|
||||
1line
|
||||
2_Multiple_Inheritance
|
||||
:learn
|
||||
:list
|
||||
Advanced
|
||||
Classes
|
||||
Comments
|
||||
Control_Flow
|
||||
Control_Flow_and_Iterables
|
||||
Functions
|
||||
Modules
|
||||
Primitive_Datatypes_and_Operators
|
||||
|
955
tests/results/15
955
tests/results/15
File diff suppressed because it is too large
Load Diff
@ -65,7 +65,9 @@ Bitmap-Bresenhams-line-algorithm
|
||||
Bitmap-Flood-fill
|
||||
Bitmap-Histogram
|
||||
Bitmap-Midpoint-circle-algorithm
|
||||
Bitmap-PPM-conversion-through-a-pipe
|
||||
Bitmap-Read-a-PPM-file
|
||||
Bitmap-Read-an-image-through-a-pipe
|
||||
Bitmap-Write-a-PPM-file
|
||||
Bitwise-IO
|
||||
Bitwise-operations
|
||||
@ -92,10 +94,12 @@ Casting-out-nines
|
||||
Catalan-numbers
|
||||
Catalan-numbers-Pascals-triangle
|
||||
Catamorphism
|
||||
Catmull-Clark-subdivision-surface
|
||||
Character-codes
|
||||
Chat-server
|
||||
Check-Machin-like-formulas
|
||||
Check-that-file-exists
|
||||
Checkpoint-synchronization
|
||||
Chinese-remainder-theorem
|
||||
Cholesky-decomposition
|
||||
Circles-of-given-radius-through-two-points
|
||||
@ -107,6 +111,7 @@ Color-of-a-screen-pixel
|
||||
Color-quantization
|
||||
Colour-bars-Display
|
||||
Colour-pinstripe-Display
|
||||
Colour-pinstripe-Printer
|
||||
Combinations
|
||||
Combinations-and-permutations
|
||||
Combinations-with-repetitions
|
||||
@ -141,6 +146,7 @@ Day-of-the-week
|
||||
Deal-cards-for-FreeCell
|
||||
Death-Star
|
||||
Deconvolution-1D
|
||||
Deconvolution-2D+
|
||||
Deepcopy
|
||||
Define-a-primitive-data-type
|
||||
Delegates
|
||||
@ -689,6 +695,7 @@ Variadic-function
|
||||
Vector-products
|
||||
Verify-distribution-uniformity-Chi-squared-test
|
||||
Verify-distribution-uniformity-Naive
|
||||
Video-display-modes
|
||||
Vigen-re-cipher
|
||||
Vigen-re-cipher-Cryptanalysis
|
||||
Visualize-a-tree
|
||||
@ -715,6 +722,7 @@ Y-combinator
|
||||
Yahoo--search-interface
|
||||
Yin-and-yang
|
||||
Zebra-puzzle
|
||||
Zeckendorf-arithmetic
|
||||
Zeckendorf-number-representation
|
||||
Zero-to-the-zero-power
|
||||
Zhang-Suen-thinning-algorithm
|
||||
|
@ -164,7 +164,7 @@
|
||||
|
||||
[38;5;246;03m// Join all elements of an array with semicolon[39;00m
|
||||
[38;5;70;01mvar[39;00m[38;5;252m [39m[38;5;252mmyArray0[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m[[39m[38;5;67m32[39m[38;5;252m,[39m[38;5;70;01mfalse[39;00m[38;5;252m,[39m[38;5;214m"js"[39m[38;5;252m,[39m[38;5;67m12[39m[38;5;252m,[39m[38;5;67m56[39m[38;5;252m,[39m[38;5;67m90[39m[38;5;252m][39m[38;5;252m;[39m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mjoin[39m[38;5;252m([39m[38;5;214m";"[39m[38;5;252m)[39m[38;5;252m [39m[38;5;246;03m// = "32;false;js;12;56;90"[39;00m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mjoin[39m[38;5;252m([39m[38;5;214m";"[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// = "32;false;js;12;56;90"[39;00m
|
||||
|
||||
[38;5;246;03m// Get subarray of elements from index 1 (include) to 4 (exclude)[39;00m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mslice[39m[38;5;252m([39m[38;5;67m1[39m[38;5;252m,[39m[38;5;67m4[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// = [false,"js",12][39;00m
|
||||
@ -562,3 +562,45 @@
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;70;01mnew[39;00m[38;5;252m [39m[38;5;252mConstructor[39m[38;5;252m([39m[38;5;252m)[39m[38;5;252m;[39m
|
||||
[38;5;252m [39m[38;5;252m}[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m
|
||||
|
||||
[38;5;246;03m// ES6 Additions[39;00m
|
||||
|
||||
[38;5;246;03m// The "let" keyword allows you to define variables in a lexical scope, [39;00m
|
||||
[38;5;246;03m// as opposed to a block scope like the var keyword does.[39;00m
|
||||
[38;5;70;01mlet[39;00m[38;5;252m [39m[38;5;252mname[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;214m"Billy"[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// Variables defined with let can be reassigned new values.[39;00m
|
||||
[38;5;252mname[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;214m"William"[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// The "const" keyword allows you to define a variable in a lexical scope[39;00m
|
||||
[38;5;246;03m// like with let, but you cannot reassign the value once one has been assigned.[39;00m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252mpi[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;67m3.14[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;252mpi[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;67m4.13[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// You cannot do this.[39;00m
|
||||
|
||||
[38;5;246;03m// There is a new syntax for functions in ES6 known as "lambda syntax".[39;00m
|
||||
[38;5;246;03m// This allows functions to be defined in a lexical scope like with variables[39;00m
|
||||
[38;5;246;03m// defined by const and let. [39;00m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252misEven[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m([39m[38;5;252mnumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m=>[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mnumber[39m[38;5;252m [39m[38;5;252m%[39m[38;5;252m [39m[38;5;67m2[39m[38;5;252m [39m[38;5;252m===[39m[38;5;252m [39m[38;5;67m0[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;252misEven[39m[38;5;252m([39m[38;5;67m7[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// false[39;00m
|
||||
|
||||
[38;5;246;03m// The "equivalent" of this function in the traditional syntax would look like this:[39;00m
|
||||
|
||||
[38;5;70;01mfunction[39;00m[38;5;252m [39m[38;5;252misEven[39m[38;5;252m([39m[38;5;252mnumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mnumber[39m[38;5;252m [39m[38;5;252m%[39m[38;5;252m [39m[38;5;67m2[39m[38;5;252m [39m[38;5;252m===[39m[38;5;252m [39m[38;5;67m0[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// I put the word "equivalent" in double quotes because a function defined[39;00m
|
||||
[38;5;246;03m// using the lambda syntax cannnot be called before the definition.[39;00m
|
||||
[38;5;246;03m// The following is an example of invalid usage:[39;00m
|
||||
|
||||
[38;5;252madd[39m[38;5;252m([39m[38;5;67m1[39m[38;5;252m,[39m[38;5;252m [39m[38;5;67m8[39m[38;5;252m)[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252madd[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m([39m[38;5;252mfirstNumber[39m[38;5;252m,[39m[38;5;252m [39m[38;5;252msecondNumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m=>[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mfirstNumber[39m[38;5;252m [39m[38;5;252m+[39m[38;5;252m [39m[38;5;252msecondNumber[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
@ -164,7 +164,7 @@
|
||||
|
||||
[38;5;246;03m// Join all elements of an array with semicolon[39;00m
|
||||
[38;5;70;01mvar[39;00m[38;5;252m [39m[38;5;252mmyArray0[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m[[39m[38;5;67m32[39m[38;5;252m,[39m[38;5;70;01mfalse[39;00m[38;5;252m,[39m[38;5;214m"js"[39m[38;5;252m,[39m[38;5;67m12[39m[38;5;252m,[39m[38;5;67m56[39m[38;5;252m,[39m[38;5;67m90[39m[38;5;252m][39m[38;5;252m;[39m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mjoin[39m[38;5;252m([39m[38;5;214m";"[39m[38;5;252m)[39m[38;5;252m [39m[38;5;246;03m// = "32;false;js;12;56;90"[39;00m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mjoin[39m[38;5;252m([39m[38;5;214m";"[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// = "32;false;js;12;56;90"[39;00m
|
||||
|
||||
[38;5;246;03m// Get subarray of elements from index 1 (include) to 4 (exclude)[39;00m
|
||||
[38;5;252mmyArray0[39m[38;5;252m.[39m[38;5;252mslice[39m[38;5;252m([39m[38;5;67m1[39m[38;5;252m,[39m[38;5;67m4[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// = [false,"js",12][39;00m
|
||||
@ -562,3 +562,45 @@
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;70;01mnew[39;00m[38;5;252m [39m[38;5;252mConstructor[39m[38;5;252m([39m[38;5;252m)[39m[38;5;252m;[39m
|
||||
[38;5;252m [39m[38;5;252m}[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m
|
||||
|
||||
[38;5;246;03m// ES6 Additions[39;00m
|
||||
|
||||
[38;5;246;03m// The "let" keyword allows you to define variables in a lexical scope, [39;00m
|
||||
[38;5;246;03m// as opposed to a block scope like the var keyword does.[39;00m
|
||||
[38;5;70;01mlet[39;00m[38;5;252m [39m[38;5;252mname[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;214m"Billy"[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// Variables defined with let can be reassigned new values.[39;00m
|
||||
[38;5;252mname[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;214m"William"[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// The "const" keyword allows you to define a variable in a lexical scope[39;00m
|
||||
[38;5;246;03m// like with let, but you cannot reassign the value once one has been assigned.[39;00m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252mpi[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;67m3.14[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;252mpi[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;67m4.13[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// You cannot do this.[39;00m
|
||||
|
||||
[38;5;246;03m// There is a new syntax for functions in ES6 known as "lambda syntax".[39;00m
|
||||
[38;5;246;03m// This allows functions to be defined in a lexical scope like with variables[39;00m
|
||||
[38;5;246;03m// defined by const and let. [39;00m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252misEven[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m([39m[38;5;252mnumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m=>[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mnumber[39m[38;5;252m [39m[38;5;252m%[39m[38;5;252m [39m[38;5;67m2[39m[38;5;252m [39m[38;5;252m===[39m[38;5;252m [39m[38;5;67m0[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;252misEven[39m[38;5;252m([39m[38;5;67m7[39m[38;5;252m)[39m[38;5;252m;[39m[38;5;252m [39m[38;5;246;03m// false[39;00m
|
||||
|
||||
[38;5;246;03m// The "equivalent" of this function in the traditional syntax would look like this:[39;00m
|
||||
|
||||
[38;5;70;01mfunction[39;00m[38;5;252m [39m[38;5;252misEven[39m[38;5;252m([39m[38;5;252mnumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mnumber[39m[38;5;252m [39m[38;5;252m%[39m[38;5;252m [39m[38;5;67m2[39m[38;5;252m [39m[38;5;252m===[39m[38;5;252m [39m[38;5;67m0[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;246;03m// I put the word "equivalent" in double quotes because a function defined[39;00m
|
||||
[38;5;246;03m// using the lambda syntax cannnot be called before the definition.[39;00m
|
||||
[38;5;246;03m// The following is an example of invalid usage:[39;00m
|
||||
|
||||
[38;5;252madd[39m[38;5;252m([39m[38;5;67m1[39m[38;5;252m,[39m[38;5;252m [39m[38;5;67m8[39m[38;5;252m)[39m[38;5;252m;[39m
|
||||
|
||||
[38;5;70;01mconst[39;00m[38;5;252m [39m[38;5;252madd[39m[38;5;252m [39m[38;5;252m=[39m[38;5;252m [39m[38;5;252m([39m[38;5;252mfirstNumber[39m[38;5;252m,[39m[38;5;252m [39m[38;5;252msecondNumber[39m[38;5;252m)[39m[38;5;252m [39m[38;5;252m=>[39m[38;5;252m [39m[38;5;252m{[39m
|
||||
[38;5;252m [39m[38;5;70;01mreturn[39;00m[38;5;252m [39m[38;5;252mfirstNumber[39m[38;5;252m [39m[38;5;252m+[39m[38;5;252m [39m[38;5;252msecondNumber[39m[38;5;252m;[39m
|
||||
[38;5;252m}[39m[38;5;252m;[39m
|
||||
|
Loading…
Reference in New Issue
Block a user