mikecargal

mikecargal

Hands-on Rust: How is output_harness supposed to be used?

Title: Hands-On Rust (Chapter 11 : Test Harnesses)

I understand the point of the test harness, but the aside left me scratching my head as to how to use it. I looked at the downloaded source and it appears that this is an independent Rust project. Is that correct? If so, does that mean we would be replicating the source files across two different projects (I know, cut/paste…simple).

At any rate, either I’m a bit dense, or it could use a bit more explanation as to how to leverage the harness.

Most Liked

mikecargal

mikecargal

I did a cargo run in that directory. That “works”, but I’m not sure that was the intention. Had to play around a minute to see that I needed to hit “Enter” to continue etc.

mikecargal

mikecargal

Hmmm… noticed the Architect constructors in the out_harness directory.

Kind of looks like some of the things I’m tripping over are possibly due to inconsistencies in keeping the files synced up(???)

example:
drunkards.rs in the output_harness uses self.map.tiles.iter() for instance, while drunkards in the drunkard dir uses mb.map.tiles.iter() (since it doesn’t have a map in the DrunkardsWalkArchitect anymore.)

herbert

herbert

Author of Hands-on Rust

Thanks! I’ve filed the architect constructors under a separate issue in the book bug tracker, that one seems to be me forgetting to merge some code. I’ll make sure that’s in there.

I agree that the harness could use a better introduction. The intent is to show how useful it can be to write code against a separate tool that shows how algorithms work before moving the code into a useful build. I think I got part way there, but didn’t really manage to show the working as well as I should have. I’ll see if I can rework that a bit for a smoother reader experience.

(As an aside, I highly recommend making little test harness programs when you try something new. It really helps to distill what’s important and makes testing a lot easier)

Popular Prag Prog topics Top

brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
alanq
This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New
cro
I am working on the “Your Turn” for chapter one and building out the restart button talked about on page 27. It recommends looking into ...
New
jskubick
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint. How to replicate: load chapter-7 from zipfile i...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1016 16836 371
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
AstonJ
Chris Seaton, the creator of TruffleRuby has died. It appears from suicide :cry: He left this note on Twitter on the weekend: And one...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New

Latest in PragProg

View all threads ❯