2015-12-11 04:24:09 +03:00
|
|
|
/*
|
2016-02-23 04:14:48 +03:00
|
|
|
* Thrifty
|
2015-12-22 23:46:23 +03:00
|
|
|
*
|
2016-02-23 04:14:48 +03:00
|
|
|
* Copyright (c) Microsoft Corporation
|
2015-12-22 23:46:23 +03:00
|
|
|
*
|
2016-02-23 04:14:48 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the License);
|
2015-12-22 23:46:23 +03:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
2016-02-23 04:14:48 +03:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
|
|
|
|
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
|
|
|
* WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
2015-12-22 23:46:23 +03:00
|
|
|
*
|
2016-02-23 04:14:48 +03:00
|
|
|
* See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
|
2015-12-11 04:24:09 +03:00
|
|
|
*/
|
2016-02-23 04:14:48 +03:00
|
|
|
namespace java com.microsoft.thrifty.compiler.testcases
|
2015-12-11 04:24:09 +03:00
|
|
|
|
|
|
|
typedef string EmailAddress
|
|
|
|
|
2015-12-12 00:46:27 +03:00
|
|
|
const list<i32> EMPTY_INT_LIST = []
|
|
|
|
const set<double> EMPTY_DOUBLE_SET = []
|
|
|
|
const map<string, list<i32>> DUMB_CONSTANT = {
|
|
|
|
"foo": [1, 2, 3],
|
|
|
|
"bar": [4, 5, 6]
|
|
|
|
}
|
|
|
|
|
2015-12-11 04:24:09 +03:00
|
|
|
struct Email {
|
2015-12-22 04:40:28 +03:00
|
|
|
1: required EmailAddress From,
|
|
|
|
2: optional list<EmailAddress> To,
|
|
|
|
3: optional list<EmailAddress> CC,
|
|
|
|
4: optional list<EmailAddress> BCC,
|
|
|
|
5: optional string Subject,
|
|
|
|
6: optional string Body,
|
|
|
|
7: required list<Attachment> Attachments = []
|
2015-12-11 04:24:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Wtf {
|
2015-12-18 02:30:41 +03:00
|
|
|
1: required map<EmailAddress, ReceiptStatus> data = {"foo@bar.com": 0, "baz@quux.com": ReceiptStatus.READ}
|
|
|
|
2: required list<map<EmailAddress, set<ReceiptStatus>>> crazy = [{"ben@thrifty.org": [1, 2]}]
|
2015-12-11 21:13:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
struct NestedLists {
|
|
|
|
1: required list<list<list<i32>>> ints = [[[4], [5]], [[], []]]
|
2015-12-11 04:24:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
union Attachment {
|
|
|
|
1: binary data,
|
|
|
|
2: string url
|
|
|
|
}
|
|
|
|
|
|
|
|
enum ReceiptStatus {
|
|
|
|
UNSENT,
|
|
|
|
SENT,
|
|
|
|
READ
|
|
|
|
}
|
|
|
|
|