Skip to content

Read and write CSV converting to or from Cuis-Smalltalk objects. Port from http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo

License

Notifications You must be signed in to change notification settings

Dynamic-Book/NeoCSV

 
 

Repository files navigation

Cuis-NeoCSV

Read and write CSV converting to or from Smalltalk objects.
Port from http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo

Log of port of version

Name: Neo-CSV-Core-SvenVanCaekenberghe.22 Author: SvenVanCaekenberghe Time: 10 May 2015, 10:07:22.199998 pm

Name: Neo-CSV-Tests-SvenVanCaekenberghe.19 Author: SvenVanCaekenberghe Time: 10 May 2015, 10:07:41.797345 pm

hhzl#5

For Cuis version Cuis4.2-2243.image

Section 1 -- Initial port without fixes

File out from Pharo 4.0 / File in into Cuis

  1. In Pharo 4.0 (May 2015) load NeoCSV package (one-click).

  2. File out class packages

    • Neo-CSV-Core
    • Neo-CSV-Tests
  3. Rename files to

    • Neo-CSV-Core-orig.st
    • Neo-CSV-Tests-orig.st
  4. In Cuis open File List.

  5. Install package SqueakCompatibility.pck.st

  6. Do the following string replacements in the original files

    Replace codePoint with unicodeCodePoint

    Replace String crlf with String crlfString

    Replace String cr with String crString

    Note: there is a space after 'cr' and 'crString'

    Replace String lf with String lfString

  7. Get code browser on 'Neo-CSV-Core-orig.st'

  8. File in classes in the following order

    • NeoNumberParser
    • NeoCSVReader
    • NeoCSVWriter
  9. Open 'World Menu'

  10. Choose 'Open'

  11. Choose 'Installed Packages'

  12. Click on 'Create Package'

  13. Type package name 'Neo-CSV-Core'

  14. Enter a description. Include reference to source of the ported file. Port of Neo-CSV-Core-SvenVanCaekenberghe.22

  15. Click on 'Save'

  16. Open File list on 'Neo-CSV-Tests.st'

  17. Get a code browser on 'Neo-CSV-Tests.st'

  18. File in class #NeoCSVTestObject

  19. File in NeoNumberParserTests

  20. File in NeoCSVReaderTests

  21. File in NeoCSVWriterTests

  22. Do not file in class #NeoCSVBenchmark as it gives a waring Wthat ZnBufferedWriteStream and ZnBufferedReadStream are not defined.

  23. Created a package 'Neo-CSV-Tests' Description: Port of Neo-CSV-Tests-SvenVanCaekenberghe.19

Unit tests

Run SUnit tests on code which was filed in:

Result is that 51 out of 52 tests passed.

Section 2 -- Analysis

The following test fails

testHexadecimalIntegers
self assert: (NeoNumberParser parse: '7B' base: 16) equals: 123.
self assert: (NeoNumberParser parse: '7b' base: 16) equals: 123.
self assert: (NeoNumberParser parse: '-7B' base: 16) equals: -123.
self assert: (NeoNumberParser parse: '-7b' base: 16) equals: -123.
self assert: (NeoNumberParser parse: '0' base: 16) equals: 0.

The test does not fail if the code is changed to

 testHexadecimalIntegers
self assert: (NeoNumberParser parse: '7B' base: 16) equals: 123.
"self assert: (NeoNumberParser parse: '7b' base: 16) equals: 123."
self assert: (NeoNumberParser parse: '-7B' base: 16) equals: -123.
"self assert: (NeoNumberParser parse: '-7b' base: 16) equals: -123."
self assert: (NeoNumberParser parse: '0' base: 16) equals: 0.

Section 3 -- Code changes

Fix code as described under section 2 -- analysis

Result after fixing

52 out of 52 tests are green.

Conclusion -- Port status

  • The port is OK.

  • The package requires SqueakCompatibility.pck.st to be loaded and at least Cuis4.2-2243.image

  • The following changes were applied to the code before file in

    Replace codePoint with unicodeCodePoint

    Replace String crlf with String crlfString

    Replace String cr with String crString

    Note: there is a space after 'cr' and 'crString'

    Replace String lf with String lfString

  • Class #NeoCSVBenchmark has not been ported.

  • Major port is done as of May 2015.

  • Documentation

About

Read and write CSV converting to or from Cuis-Smalltalk objects. Port from http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • StringTemplate 51.3%
  • Smalltalk 48.7%