-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
2,869 additions
and
679 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
bring http; | ||
bring "./../../valid/assertions.w" as assertions; | ||
|
||
test "parseUrl()" { | ||
let assertThrows = (expected: str, block: (): void) => { | ||
let var error = false; | ||
try { | ||
block(); | ||
} catch actual { | ||
assert(actual == expected); | ||
error = true; | ||
} | ||
assert(error); | ||
}; | ||
|
||
let INVALID_URL_STRING = "hello world"; | ||
let INVALID_URL_ERROR = "Invalid URL: ${INVALID_URL_STRING}"; | ||
let URL_STRING = "http://username:[email protected]:3000/pathname?search=test#hash"; | ||
|
@@ -33,23 +23,12 @@ test "parseUrl()" { | |
let parsedUrlStruct = http.parseUrl(URL_STRING); | ||
assert(urlStruct == parsedUrlStruct); | ||
|
||
assertThrows(INVALID_URL_ERROR, () => { | ||
assertions.Assert.throws(INVALID_URL_ERROR, () => { | ||
let invalidUrlStruct = http.parseUrl(INVALID_URL_STRING); | ||
}); | ||
} | ||
|
||
test "formatUrl()" { | ||
let assertThrows = (expected: str, block: (): void) => { | ||
let var error = false; | ||
try { | ||
block(); | ||
} catch actual { | ||
assert(actual == expected); | ||
error = true; | ||
} | ||
assert(error); | ||
}; | ||
|
||
let UNABLE_TO_FORMAT_URL_STRUCT_ERROR = "Unable to format URL Struct: Invalid URL"; | ||
let urlStruct = http.parseUrl("https://a:b@測試.com/path?query=1#fragment"); | ||
|
||
|
@@ -80,7 +59,7 @@ test "formatUrl()" { | |
password: urlStruct.password, | ||
}; | ||
|
||
assertThrows(UNABLE_TO_FORMAT_URL_STRUCT_ERROR, () => { | ||
assertions.Assert.throws(UNABLE_TO_FORMAT_URL_STRUCT_ERROR, () => { | ||
http.formatUrl(invalidUrlStruct); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,28 @@ | ||
bring math; | ||
try { | ||
bring "./../../valid/assertions.w" as assertions; | ||
|
||
assertions.PreflightAssert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.acos(-2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
assert(math.acos(-1) == math.PI); | ||
assert(math.acos(-0) == 1.5707963267948966); | ||
assert(math.acos(0) == 1.5707963267948966); | ||
assert(math.acos(0.5) == 1.0471975511965979); | ||
assert(math.acos(1) == 0); | ||
try { | ||
assertions.PreflightAssert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.acos(2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
|
||
test "inflight arc cosine" { | ||
try { | ||
assertions.Assert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.acos(-2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
assert(math.acos(-1) == math.PI); | ||
assert(math.acos(-0) == 1.5707963267948966); | ||
assert(math.acos(0) == 1.5707963267948966); | ||
assert(math.acos(0.5) == 1.0471975511965979); | ||
assert(math.acos(1) == 0); | ||
try { | ||
assertions.Assert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.acos(2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,28 @@ | ||
bring math; | ||
try { | ||
bring "./../../valid/assertions.w" as assertions; | ||
|
||
assertions.PreflightAssert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.asin(-2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
assert(math.asin(-1) == -1.5707963267948966); | ||
assert(math.asin(-0) == -0); | ||
assert(math.asin(0) == 0); | ||
assert(math.asin(0.5) == 0.5235987755982989); | ||
assert(math.asin(1) == 1.5707963267948966); | ||
try { | ||
assertions.PreflightAssert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.asin(2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
|
||
test "inflight arc sine" { | ||
try { | ||
assertions.Assert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.asin(-2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
assert(math.asin(-1) == -1.5707963267948966); | ||
assert(math.asin(-0) == -0); | ||
assert(math.asin(0) == 0); | ||
assert(math.asin(0.5) == 0.5235987755982989); | ||
assert(math.asin(1) == 1.5707963267948966); | ||
try { | ||
assertions.Assert.throws("Input value must be between -1 and 1, inclusive.", () => { | ||
log("${math.asin(2)}"); | ||
} catch e { | ||
assert(e == "Input value must be between -1 and 1, inclusive."); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.