Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 2.7 read_word definition doesn't match test harness or solution code #20

Closed
jackc opened this issue Aug 4, 2017 · 4 comments

Comments

@jackc
Copy link

jackc commented Aug 4, 2017

The definition for read_word:

Accepts a buffer address and size as arguments ...

Test harness and code appear to expect read_word to use word_buffer memory location instead of arguments.

@sayon
Copy link
Collaborator

sayon commented Aug 4, 2017

Thank you for reporting this. It should be fixed in #23. Please tell me if this worked for you -- I've added some more tests as well.

@jackc
Copy link
Author

jackc commented Aug 5, 2017

I get further this time, but the last test for read_word doesn't match the requirements in the book.

Stops and returns 0 if word is too big for the buffer specified; otherwise returns a buffer address.

The test:

          testing read_word on "asdbaskdbaksvbaskvhbashvbasdasdads wewe"
  read_word : compiled
" asdbaskdbaksvbaskvhbashvbasdasdads wewe " -> ('asdbaskdbaksvbaskvh', 0)
  [   ok   ]

The first 19 characters + terminating null expected by the test harness and sample code - whereas the book requirements are to return 0 when too big.

Also, I found an errata at the end of the chapter (sorry, I bought the book on Kindle so I don't have real page numbers). Footnote 7 lists the codes for what is considered whitespace. 0x10 is not new line. It should be 0xA or decimal 10.

@sayon
Copy link
Collaborator

sayon commented Aug 5, 2017

  1. It seems that there is a missing point in read_word description: it should return the word length in rdx. I'll add that to errata
  2. Sorry for the bad specs, fix tests for read_word in the first assignment #26 should do it. I've taken liberty in poking your solution and after uncommenting the lines 189-190 to enable returning string length in rdx the read_word tests are being passed correctly.
  3. Thanks for reporting the error in the footnote, I am fixing it. This is unfortunate, I've not imagined Kindle version will have different page numbers. I am going to put section numbers in the errata as well. Are all footnotes shown at the end of the chapter?

@jackc
Copy link
Author

jackc commented Aug 5, 2017

👍 Works now. Thanks!

Kindle reformats for the size of device so it doesn't have real page numbers. Section numbers would be great for errata. And yes, footnotes are at the end of the chapter.

@jackc jackc closed this as completed Aug 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants