Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-01

How to test fpjson?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hello,

First, sorry for the silly question! ^^'

So, I want to send some improviments to the `jsonscanner` and `jsonparser` units based on the updated JSON RFC <https://tools.ietf.org/html/rfc7159>, however I need to check if their previous implementations will continue working after my changes.

I found the directory `freepascal\tests`, but I can't find any test for the `TJSONScanner` unit.

Is the `testjsonparser` unit all the tests for FCL JSON, or can I find more tests in another place?

Thank you!

Silvio Clécio

Reply by email

Graeme Geldenhuys
to silvioprog
silvioprog wrote
Is the `testjsonparser` unit all the tests for FCL JSON, or can I find more tests in another place?

I have more unit test units in the <fpc>/src/packages/fcl-json/tests/ directory.

But I assume you are referring specifically to the JSON parser functionality. In that case, Michael van Canneyt is probably the best person to answer that. But I would have assumed all available unit tests are in the fcl-json/tests/ directory.

Regards,
- Graeme -

Reply by email

silvioprog
to Graeme Geldenhuys

On Wed, Jan 27, 2016 at 2:41 PM, Graeme Geldenhuys <

Show quoted text 9 lines
wrote: On 2016-01-27 17:28, silvioprog wrote: > Is the `testjsonparser` unit all the tests for FCL JSON, or can I find more > tests in another place? I have more unit test units in the <fpc>/src/packages/fcl-json/tests/ directory.

[...]

I can't find any test for `TJSONScanner` class.

In that case, Michael van Canneyt is probably the best person to answer

that.

[...]

Let's expect his answer. :-)

Silvio Clécio

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 21 lines
On Wed, Jan 27, 2016 at 2:41 PM, Graeme Geldenhuys < > wrote: > On 2016-01-27 17:28, silvioprog wrote: >> Is the `testjsonparser` unit all the tests for FCL JSON, or can I find > more >> tests in another place? > > I have more unit test units in the <fpc>/src/packages/fcl-json/tests/ > directory. [...] I can't find any test for `TJSONScanner` class. In that case, Michael van Canneyt is probably the best person to answer > that. [...] Let's expect his answer. :-)

You can add tests to the TTestParser class in the testjsonparser.pp unit.

if you want to test purely data related stuff, use classes in testjsondata.pp

Michael.

Reply by email

silvioprog
to Michael Van Canneyt

On Wed, Jan 27, 2016 at 3:40 PM, Michael Van Canneyt <

Show quoted text 38 lines
wrote: On Wed, 27 Jan 2016, silvioprog wrote: > On Wed, Jan 27, 2016 at 2:41 PM, Graeme Geldenhuys < > > wrote: > > On 2016-01-27 17:28, silvioprog wrote: >> >>> Is the `testjsonparser` unit all the tests for FCL JSON, or can I find >>> >> more >> >>> tests in another place? >>> >> >> I have more unit test units in the <fpc>/src/packages/fcl-json/tests/ >> directory. >> > > [...] > > I can't find any test for `TJSONScanner` class. > > In that case, Michael van Canneyt is probably the best person to answer > >> that. >> > > [...] > > Let's expect his answer. :-) > You can add tests to the TTestParser class in the testjsonparser.pp unit. if you want to test purely data related stuff, use classes in testjsondata.pp

Nice! :-)

I already found two failures, but I don't know if it something in my environment (Lazarus 1.7 rUnknown FPC 3.1.1 i386-win32-win32/win64):

C:\[...]fcl-json\tests>testjson.exe > result.txt
Heap dump by heaptrc unit
34687 memory blocks allocated : 1332965/1459696
34687 memory blocks freed : 1332965/1459696
0 unfreed memory blocks : 0
True heap size : 360448 (112 used in System startup) True free heap : 360336

Number of run tests: 321
Number of errors: 0
Number of failures: 2

See the `result.txt` large content here: http://pastebin.com/JTC93esY.

Silvio Clécio

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 5 lines
Nice! :-) I already found two failures, but I don't know if it something in my environment (Lazarus 1.7 rUnknown FPC 3.1.1 i386-win32-win32/win64):

It is related to i386. On 64-bit (the platform I work on) it does not occur. I didn't find time yet to idea why it happens.

Michael.

Reply by email

silvioprog
to Michael Van Canneyt

On Thu, Jan 28, 2016 at 4:50 AM, Michael Van Canneyt <

Show quoted text 12 lines
wrote: On Wed, 27 Jan 2016, silvioprog wrote: > > Nice! :-) > > I already found two failures, but I don't know if it something in my > environment (Lazarus 1.7 rUnknown FPC 3.1.1 i386-win32-win32/win64): > It is related to i386. On 64-bit (the platform I work on) it does not occur. I didn't find time yet to idea why it happens.

I'll try to debug it ASAP. ;-)

Silvio Clécio

Reply by email