-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestunUsed2.jl
87 lines (64 loc) · 2.01 KB
/
testunUsed2.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using Test
include("helper.jl")
#include("./unUsed2.jl")
@test 2 === 1+1
# Yin
function doSubtract(isWhole)
#0. Initialize
subtract :: Int64 = 1
#1. Check if `isWhole` is `false` (2 Middles)
#=
if isWhole == false
subtract = 2
#2. Check number `isWhole` (1 Middle)
elseif isWhole == true
subtract = 1 =#
#3. isWhole is true
if isWhole == true
subtract = 1
elseif isWhole == false
subtract = 2
#4. raise an `exceptionParameter` [default]
else
raise(UnexpectedError)
end
#4. Return `subtract` value
return subtract
end
# getSubtractedValue(::Bool, ::String)
function getSubtractedValue( isWhole :: Bool , msg :: String = msg; exceptionParameter :: String = UnexpectedError )
try
#0. Initialize
subtract :: Int64 = 1
#1.checks if `isWhole` is `true` (1 Middle)
if isWhole == true
# subtract = 1
#2. Check if `isWhole` is `false` (2 Middles)
elseif isWhole == false
subtract = 2
#3. raise an `exceptionParameter` [default]
else
raise(exceptionParameter)
end
#4. Return `subtract` value
subtract
catch UnexpectedError
writeError( msg, exceptionParameter)
end
end
isWhole = true
Test.@test getSubtractedValue(false, msg) == 2 # true
Test.@test getSubtractedValue(false) == 2 # true
#Test.@test getSubtractedValue(true) == 1 # false
isWhole = false
Test.@test getSubtractedValue(true,msg) == 1 # true
Test.@test getSubtractedValue(true) == 1 # true
#Test.@test getSubtractedValue(false) == 2 # false
function calcTotalMiddles(arr=[1,2,3,4,5])
return length(arr) #5
end
print( calcTotalMiddles() )
#TODO: Demo below : TODO: Replace compareQuartet with the one you just have solved.
lowerBound1 :: Int64 = 1;
upperBound1 :: Int64 = 9;
view(collect(lowerBound1 : upperBound1 ), (lowerBound1 : upperBound1 ))