Skip to content

Commit

Permalink
Add serialization for type: char[][]
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejlach committed Mar 23, 2015
1 parent bdfa408 commit d92fe9b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
------------------------------------------------------------------------------
qSharp 2.1.1 [TBA]
qSharp 2.1.1 [2015.03.23]
------------------------------------------------------------------------------

- Fix: sanity check against protocol version for guids
- Add serialization for type: char[][]

------------------------------------------------------------------------------
qSharp 2.1.0 [2014.10.01]
Expand Down
1 change: 1 addition & 0 deletions qSharp/src/QType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public static class QTypes
{typeof (double[]), QType.DoubleList},
{typeof (char), QType.Char},
{typeof (char[]), QType.String},
{typeof (char[][]), QType.GeneralList},
{typeof (string), QType.Symbol},
{typeof (string[]), QType.SymbolList},
{typeof (QTimestamp), QType.Timestamp},
Expand Down
12 changes: 11 additions & 1 deletion qSharp/test/QExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ internal class QExpressions
{"``quick``fox", new[] {"", "quick", "", "fox" }},
{"``", new[] {"", ""}},
{"(\"quick\"; \"brown\"; \"fox\"; \"jumps\"; \"over\"; \"a lazy\"; \"dog\")", new object[] {"quick".ToCharArray(), "brown".ToCharArray(), "fox".ToCharArray(), "jumps".ToCharArray(), "over".ToCharArray(), "a lazy".ToCharArray(), "dog".ToCharArray() }},
{"(\"quick\"; \"brown\"; \"fox\")", new char[][] {"quick".ToCharArray(), "brown".ToCharArray(), "fox".ToCharArray() }},
{
"2000.01.04D05:36:57.600 0Np",
new[] {new QTimestamp(279417600000000), new QTimestamp(long.MinValue)}
Expand Down Expand Up @@ -290,6 +291,7 @@ internal class QExpressions
{"``quick``fox", new[] {"", "quick", "", "fox" }},
{"``", new[] {"", ""}},
{"(\"quick\"; \"brown\"; \"fox\"; \"jumps\"; \"over\"; \"a lazy\"; \"dog\")", new object[] {"quick".ToCharArray(), "brown".ToCharArray(), "fox".ToCharArray(), "jumps".ToCharArray(), "over".ToCharArray(), "a lazy".ToCharArray(), "dog".ToCharArray() }},
{"(\"quick\"; \"brown\"; \"fox\")", new char[][] {"quick".ToCharArray(), "brown".ToCharArray(), "fox".ToCharArray() }},
{
"2000.01.04D05:36:57.600 0Np",
new[] {new QTimestamp(279417600000000), new QTimestamp(long.MinValue)}
Expand Down Expand Up @@ -452,7 +454,15 @@ public byte[] GetBinaryExpression(string version, string key)

public object GetReferenceObject(string version, string key)
{
return reference[version][key];
try
{
return reference[version][key];
}
catch (Exception e)
{
Console.Error.WriteLine(string.Format("Cannot retrieve key: {0}", key));
throw e;
}
}

private static byte[] StringToByteArray(String hex)
Expand Down
2 changes: 2 additions & 0 deletions qSharp/test/QExpressions.3.out
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ ED00000080
0B00020000000000
("quick"; "brown"; "fox"; "jumps"; "over"; "a lazy"; "dog")
0000070000000A0005000000717569636B0A000500000062726F776E0A0003000000666F780A00050000006A756D70730A00040000006F7665720A000600000061206C617A790A0003000000646F67
("quick"; "brown"; "fox")
0000030000000A0005000000717569636B0A000500000062726F776E0A0003000000666F78
2000.01.04D05:36:57.600 0Np
0C000200000000C0CAFA20FE00000000000000000080
(2001.01m; 0Nm)
Expand Down
2 changes: 2 additions & 0 deletions qSharp/test/QExpressions.out
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ ED00000080
0B00020000000000
("quick"; "brown"; "fox"; "jumps"; "over"; "a lazy"; "dog")
0000070000000A0005000000717569636B0A000500000062726F776E0A0003000000666F780A00050000006A756D70730A00040000006F7665720A000600000061206C617A790A0003000000646F67
("quick"; "brown"; "fox")
0000030000000A0005000000717569636B0A000500000062726F776E0A0003000000666F78
2000.01.04D05:36:57.600 0Np
0C000200000000C0CAFA20FE00000000000000000080
(2001.01m; 0Nm)
Expand Down

0 comments on commit d92fe9b

Please sign in to comment.