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 Pragmatic Bookshelf topics Top

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
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
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
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
brunogirin
When installing Cards as an editable package, I get the following error: ERROR: File “setup.py” not found. Directory cannot be installe...
New
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New
dachristenson
I’ve got to the end of Ch. 11, and the app runs, with all tabs displaying what they should – at first. After switching around between St...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
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
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New

Latest in Hands-on Rust

Hands-on Rust Portal