Re: [libgpiod v2][PATCH v2] bindings: cxx: tests: use the builder pattern for the GPIO simulator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 15, 2022 at 06:01:39PM +0800, Kent Gibson wrote:
> On Thu, Sep 15, 2022 at 10:47:23AM +0200, Bartosz Golaszewski wrote:
> > In order to make the interface more elegant use the Rust-like builder
> > pattern for the GPIO simulator class.
> > 
> > Signed-off-by: Bartosz Golaszewski <brgl@xxxxxxxx>
> > ---
> 
> > -	::gpiosim::chip sim({{ property::NUM_LINES, 8 }, { property::LABEL, "foobar" }});
> > +	auto sim = make_sim()
> > +		.set_num_lines(8)
> > +		.set_label("foobar")
> > +		.build();
> > +
> 
> You do this a few times, so perhaps add a helper to create a simple
> simulator with a given a number of lines?
> 
> (I called the equivalent in my tests a Simpleton, borrowing LinusW's
> practice of naming things after yourself.
> Not that I'm suggesting you use that name.)

Good grief - I meant LinusT.  See what I mean?

Cheers,
Kent.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux