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)

Where Next?

Popular Pragmatic Bookshelf topics Top

New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
Henrai
Hi, I’m working on the Chapter 8 of the book. After I add add the point_offset, I’m still able to see acne: In the image above, I re...
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
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

wolf4earth
@AstonJ prompted me to open this topic after I mentioned in the lockdown thread how I started to do a lot more for my fitness. https://f...
New
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New

Sub Categories: