-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds text descriptions for intended system macro test cases (#128)
--------- Co-authored-by: Zack Slayton <zack.slayton@gmail.com> Co-authored-by: Tyler Gregg <greggt@amazon.com>
- Loading branch information
1 parent
8dd641c
commit d6ffc3c
Showing
27 changed files
with
284 additions
and
33 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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// add_macros can be invoked using any type of macro reference. | ||
// the argument values may be zero or more macro definitions | ||
// add_macros does not have any side-effects on the symbol table | ||
// add_macros should append its arguments to the macro table of the default module | ||
// annotations on any argument value should signal an error (because it's not allowed in the macro table rather than because of any specific validation by the add_macros macro) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// add_symbols can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null text values | ||
// add_symbols does not have any side-effects on the macro table | ||
// add_symbols should append its arguments to the symbol table of the default module | ||
// annotations on any argument value should signal an error (because it's not allowed in the symbol table rather than because of any specific validation by the add_symbols macro) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// annotate can be invoked using any type of macro reference. | ||
// annotate adds annotations to a value | ||
// if the value has existing annotations, they are preserved and annotate prepends annotations to the existing annotations of the value | ||
// the first argument must be zero or more non-null text values ($0 is allowed) | ||
// the second argument must be a single expression that also expands to a single expression |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// default can be invoked using any type of macro reference. | ||
// both arguments may be any expression or expression group | ||
// if the first argument is non-empty | ||
// - `default` produces the first argument as its result | ||
// - the second argument is not expanded | ||
// if the first argument is empty (i.e. none), `default` produces the second argument as its result |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// delta can be invoked using any type of macro reference. | ||
// the arguments of delta must be non-null integers | ||
// the "initial" argument is required | ||
// the "delta" argument can be zero or more values | ||
// any annotations on the arguments are silently dropped | ||
// the output of delta is defined as follows: | ||
// output₀ = initial + delta₀ | ||
// outputₙ₊₁ = outputₙ + deltaₙ₊₁ |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// flatten can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null lists and s-expressions | ||
// flatten expands to a stream whose elements are the concatenated elements of all its arguments | ||
// annotations on the argument (list and sexp) values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_blob can be invoked using any type of macro reference. | ||
// make_blob creates a single unannotated blob from zero or more lob values | ||
// null values and non-lob values must signal an error | ||
// annotations on the argment values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_decimal can be invoked using any type of macro reference. | ||
// make_decimal creates a single unannotated decimal | ||
// the coefficient argument must be a non-null integer | ||
// the exponent argument must be a non-null integer | ||
// annotations on the argument values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_field can be invoked using any type of macro reference. | ||
// the first argument must expand to a single non-null text value (`$0` is allowed) | ||
// annotations first argument are silently dropped | ||
// the second argument may be any single expression that expands to a single expression | ||
// make_field expands to a single unannotated struct containing only field(s) with the first argument as the field name, | ||
// and the second argument value as the field value. |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_list can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null lists and s-expressions | ||
// make_list creates a single unannotated list whose elements are the concatenated elements of all its arguments | ||
// annotations on the argument values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_sexp can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null lists and s-expressions | ||
// make_sexp creates a single unannotated s-expression whose elements are the concatenated elements of all its arguments | ||
// annotations on the argument values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_string can be invoked using any type of macro reference. | ||
// make_string creates a single unannotated string from zero or more text values | ||
// null values, unknown symbol text, and non-text values must signal an error | ||
// annotations on the argment values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_struct can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null structs | ||
// make_struct creates a single unannotated struct whose fields are the concatenated fields of all its arguments | ||
// annotations on the argument values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_symbol can be invoked using any type of macro reference. | ||
// make_symbol creates a single unannotated symbol from zero or more text values | ||
// null values, unknown symbol text, and non-text values must signal an error | ||
// annotations on the argment values are silently dropped |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// make_timestamp can be invoked using any type of macro reference. | ||
// make_timestamp creates a single unannotated timestamp | ||
// any annotations on the argment values are silently dropped | ||
// if any argument is null, it should signal an error | ||
// year must be from 0 to 9999 (inclusive) | ||
// month must be from 1 to 12 (inclusive) | ||
// if month is present, year must also be present | ||
// day must be from 1 to 28,29,30, or 31 (inclusive) depending on the month | ||
// if day is present, month must also be present | ||
// hour must be from 0 to 23 (inclusive) | ||
// if hour is present, minute and day must also be present | ||
// minute must be from 0 to 59 (inclusive) | ||
// if minute is present, hour must also be present | ||
// second must be a decimal value from +0 to 60 (exclusive) with any precision | ||
// if second is present, minute must also be present | ||
// offset minutes argument may not be present unless minutes is present. | ||
// if offset minutes is present, it must be in the range -1440 to 1440 (inclusive) | ||
// if offset minutes is absent, the resulting timestamp has unknown offset. |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// meta can be invoked using any type of macro reference. | ||
// meta has one parameter that accepts zero-to-many argument expressions and always produces nothing |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// none can be invoked using any type of macro reference. | ||
// none accepts no arguments and produces nothing |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
(ion_1_1 "parse_ion can be invoked" | ||
(each "in text with an unqualified macro name" | ||
(text ''' (:parse_ion "true") ''') | ||
"in text with an unqualified macro address" | ||
(text ''' (:16 "true") ''') | ||
"in text with a qualified macro name" | ||
(text ''' (:$ion::parse_ion "true") ''') | ||
"in text with a qualified macro address" | ||
(text ''' (:$ion::16 "true") ''') | ||
"in binary with a system macro address" | ||
(binary "EF 10 94 74 72 75 65") | ||
"in binary with a user macro address" | ||
(binary "10 94 74 72 75 65") | ||
(produces true))) | ||
|
||
// parse_ion can read Ion 1.0 and Ion 1.1, text and binary | ||
|
||
// parse_ion always produces user values. See https://github.com/amazon-ion/ion-docs/issues/365 for complications to be resolved. | ||
|
||
// parse_ion requires exactly one argument | ||
|
||
// parse_ion argument must be a string or lob literal |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// repeat can be invoked using any type of macro reference. | ||
// repeat can repeat things the correct number of times | ||
// the number of repetitions must be a single expression that expands to one positive integer (i.e. an integer greater than zero) | ||
// the thing to be repeated must be at least one expression of any type |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// set_macros can be invoked using any type of macro reference. | ||
// the argument values may be zero or more macro definitions | ||
// TODO: Could it also be a module or an export? | ||
// set_macros does not have any side-effects on the symbol table | ||
// set_macros replaces the current macro table with a new macro table that consists of the arguments of set_macros | ||
// annotations on any argument value should signal an error (because it's not allowed in the macro table rather than because of any specific validation by the set_macros macro) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// set_symbols can be invoked using any type of macro reference. | ||
// the argument values may be zero or more non-null text values | ||
// set_symbols does not have any side-effects on the macro table | ||
// set_symbols replaces the current symbol table with a new symbol table that consists of the arguments of set_symbols | ||
// annotations on any argument value should signal an error (because it's not allowed in the symbol table rather than because of any specific validation by the set_symbols macro) |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// sum can be invoked using any type of macro reference. | ||
// the arguments of sum must be zero or more non-null integers | ||
// any annotations on the arguments are silently dropped | ||
// the output of sum is the sum of all its argument values |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// `use` can be invoked using any type of macro reference. | ||
// the first parameter must have a single argument value that is a non-null, unannotated string | ||
// the second parameter may be absent or it may be a single value that is a non-null, unannotated, positive integer | ||
// if the second parameter is absent, it has an implicit default value of 1 | ||
// if the <catalog_key, version> pair cannot be located, in the catalog, the reader should signal an error | ||
// invoking `use` should preserve all existing symbols and macros | ||
// invoking `use` should import the specified module and append its content to the default module's symbol table and macro table | ||
// `use` should not (re)define any existing stream-level module bindings |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Test Cases: | ||
// values can be invoked using any type of macro reference. | ||
// values has one parameter that accept zero-to-many arguments and produces its input |