Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Writable Json DOM - JsonNumber implementation and tests (#39917)
Browse files Browse the repository at this point in the history
* Json prototype (#1)

Basic API for Json writable DOM with scenarios including collection initialization, accessing and modifying Json nodes.

* Json prototype - transformation API  (#2)

* transformation API added
* assertions to existing scenarios added

* Json prototype (#1)

Basic API for Json writable DOM with scenarios including collection initialization, accessing and modifying Json nodes.

* Json prototype - transformation API  (#2)

* transformation API added
* assertions to existing scenarios added

* JsonNumber implementation and tests (#3)

* IEquatables added
* JsonNumber implementation and unit tests added
* pragmas deleted
* review comments included, more tests added
* decimal support added to JsonNumber
* decimal support added to JsonArray and JsonObject

* all unimplemented classes and methods with accompanying tests removed

* First part of documentation added

* documentation completed

* missing exceptions added

* JsonElement changes removed

* part of the review comments included

* work on review comments

* code refactor

* more decimal tests added using MemberData

* more decimal tests added using MemberData

* more test cases added

* equals summary adjusted, equals tests added

* more Equals tests added, GetHashCode tests added, minor changes

* scientifing notation support added, rational numbers tests fixes

* rational overflow tests added

* ulong maxvalue tests added to rational types

* presision problems fixes

* exception strings fixed

* CI failing fixes (hopefully), review comments included

* missing == tests added to achieve 100% branch coverage

* review comments included

* trailing whitespaces fixes

* equals comments added

* equals object refactored to call quals json number

* merge fix
  • Loading branch information
kasiabulat authored and msftbot[bot] committed Aug 9, 2019
1 parent 3825673 commit 5050ee8
Show file tree
Hide file tree
Showing 7 changed files with 1,482 additions and 1 deletion.
91 changes: 91 additions & 0 deletions src/System.Text.Json/ref/System.Text.Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,97 @@ protected JsonNamingPolicy() { }
public static System.Text.Json.JsonNamingPolicy CamelCase { get { throw null; } }
public abstract string ConvertName(string name);
}
public abstract partial class JsonNode
{
internal JsonNode() { }
}
public sealed partial class JsonNumber : System.Text.Json.JsonNode, System.IEquatable<System.Text.Json.JsonNumber>
{
public JsonNumber() { }
public JsonNumber(byte value) { }
public JsonNumber(decimal value) { }
public JsonNumber(double value) { }
public JsonNumber(short value) { }
public JsonNumber(int value) { }
public JsonNumber(long value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(sbyte value) { }
public JsonNumber(float value) { }
public JsonNumber(string value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(ushort value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(uint value) { }
[System.CLSCompliantAttribute(false)]
public JsonNumber(ulong value) { }
public override bool Equals(object obj) { throw null; }
public bool Equals(System.Text.Json.JsonNumber other) { throw null; }
public byte GetByte() { throw null; }
public decimal GetDecimal() { throw null; }
public double GetDouble() { throw null; }
public override int GetHashCode() { throw null; }
public short GetInt16() { throw null; }
public int GetInt32() { throw null; }
public long GetInt64() { throw null; }
[System.CLSCompliantAttribute(false)]
public sbyte GetSByte() { throw null; }
public float GetSingle() { throw null; }
[System.CLSCompliantAttribute(false)]
public ushort GetUInt16() { throw null; }
[System.CLSCompliantAttribute(false)]
public uint GetUInt32() { throw null; }
[System.CLSCompliantAttribute(false)]
public ulong GetUInt64() { throw null; }
public static bool operator ==(System.Text.Json.JsonNumber left, System.Text.Json.JsonNumber right) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (byte value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (decimal value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (double value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (short value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (int value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (sbyte value) { throw null; }
public static implicit operator System.Text.Json.JsonNumber (float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public static implicit operator System.Text.Json.JsonNumber (ulong value) { throw null; }
public static bool operator !=(System.Text.Json.JsonNumber left, System.Text.Json.JsonNumber right) { throw null; }
public void SetByte(byte value) { }
public void SetDecimal(decimal value) { }
public void SetDouble(double value) { }
public void SetFormattedValue(string value) { }
public void SetInt16(short value) { }
public void SetInt32(int value) { }
public void SetInt64(long value) { }
[System.CLSCompliantAttribute(false)]
public void SetSByte(sbyte value) { }
public void SetSingle(float value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt16(ushort value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt32(uint value) { }
[System.CLSCompliantAttribute(false)]
public void SetUInt64(ulong value) { }
public override string ToString() { throw null; }
public bool TryGetByte(out byte value) { throw null; }
public bool TryGetDecimal(out decimal value) { throw null; }
public bool TryGetDouble(out double value) { throw null; }
public bool TryGetInt16(out short value) { throw null; }
public bool TryGetInt32(out int value) { throw null; }
public bool TryGetInt64(out long value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetSByte(out sbyte value) { throw null; }
public bool TryGetSingle(out float value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt16(out ushort value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt32(out uint value) { throw null; }
[System.CLSCompliantAttribute(false)]
public bool TryGetUInt64(out ulong value) { throw null; }
}
public readonly partial struct JsonProperty
{
private readonly object _dummy;
Expand Down
5 changes: 4 additions & 1 deletion src/System.Text.Json/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,7 @@
<data name="SerializerCycleDetected" xml:space="preserve">
<value>A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of {0}.</value>
</data>
</root>
<data name="EmptyStringToInitializeNumber" xml:space="preserve">
<value>Expected a number, but instead got empty string.</value>
</data>
</root>
4 changes: 4 additions & 0 deletions src/System.Text.Json/src/System.Text.Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,8 @@
<Reference Include="System.Threading.Tasks" />
<Reference Include="System.Threading.Tasks.Extensions" />
</ItemGroup>
<ItemGroup>
<Compile Include="System\Text\Json\Node\JsonNode.cs" />
<Compile Include="System\Text\Json\Node\JsonNumber.cs" />
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions src/System.Text.Json/src/System/Text/Json/Node/JsonNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Text.Json
{
/// <summary>
/// The base class that represents a single node within a JSON document.
/// </summary>
public abstract class JsonNode
{
private protected JsonNode() { }
}
}
Loading

0 comments on commit 5050ee8

Please sign in to comment.