On Tuesday, 10 September 2024 at 01:04:15 UTC, Jonathan M Davis
wrote:
When I run it locally, assertThrown passes as expected for test
case 5, and the same happens on run.dlang.io, so nothing in my
specific setup is making it pass when it normally wouldn't.
So, unless you verified that your
On Monday, September 9, 2024 6:40:07 PM MDT kookman via Digitalmars-d-learn
wrote:
> On Tuesday, 10 September 2024 at 00:27:43 UTC, Jonathan M Davis
>
> wrote:
> > On Monday, September 9, 2024 5:46:18 PM MDT kookman via
> >
> > Digitalmars-d-learn wrote:
> >> It seems like assertThrown works as ex
On Tuesday, 10 September 2024 at 00:27:43 UTC, Jonathan M Davis
wrote:
On Monday, September 9, 2024 5:46:18 PM MDT kookman via
Digitalmars-d-learn wrote:
It seems like assertThrown works as expected for case 4, but
mysteriously not working for case 5 - despite the code under
test raising the sa
On Monday, September 9, 2024 5:46:18 PM MDT kookman via Digitalmars-d-learn
wrote:
> It seems like assertThrown works as expected for case 4, but
> mysteriously not working for case 5 - despite the code under test
> raising the same exception. Am I missing something stupid here?
At a glance, it l
I'm having trouble understanding why the assertThrown in unit
test 5 is not behaving in the code below:
```
ubyte[] decodeBase32(string encoded) {
import std.string: indexOf, stripRight;
// Remove padding if present
encoded = encoded.stripRight("=");
ubyte[] result;
size_t
On Monday, 9 September 2024 at 20:52:09 UTC, WraithGlade wrote:
In any case, this version seems more brittle than the others at
least
After all, you will need it in 2 ways: 1. to learn, 2. to test.
After testing, you can disable it with just the version parameter
while compiling. It is even p
On Monday, 9 September 2024 at 20:52:09 UTC, WraithGlade wrote:
This is not that surprising considering it uses hardcoded
numbers and doesn't look right.
I made it on dlang.io which does space tabs, if its not ovisous
to a beginner, parse is ~~lazy~~ not correct, it need to do find
substrin
On Monday, 9 September 2024 at 17:56:04 UTC, monkyyy wrote:
On Monday, 9 September 2024 at 17:39:46 UTC, WraithGlade wrote:
import std;
auto parse(char[] s)=>s[9..$-2];
void show(T,string file= __FILE__,int line=__LINE__)(T t){
writeln(File(file).byLine.drop(line-1).front.parse," ==
",t)
On Monday, 9 September 2024 at 20:02:48 UTC, Jabari Zakiya wrote:
I have this code to input integer values:
```
ulong[] x;
foreach (_; 0 .. 2) { ulong a; readf!" %d"(a); x ~= a; }
end_num = max(x[0], 3);
start_num = max(x[1], 3);
if (start_num > end_num) swap(start_num, end_num);
sta
On Monday, 9 September 2024 at 20:02:48 UTC, Jabari Zakiya wrote:
Also for output, I do this:
```
writeln("total twins = ", twinscnt, "; last twin = ", last_twin
- 1, "+/-1");
```
I'd also like to output data as: 123,987 or 123_987
You can use separators using writefln:
```d
writefln("%,
On Monday, 9 September 2024 at 20:02:48 UTC, Jabari Zakiya wrote:
I have this code to input integer values:
```
ulong[] x;
foreach (_; 0 .. 2) { ulong a; readf!" %d"(a); x ~= a; }
end_num = max(x[0], 3);
start_num = max(x[1], 3);
if (start_num > end_num) swap(start_num, end_num);
sta
I have this code to input integer values:
```
ulong[] x;
foreach (_; 0 .. 2) { ulong a; readf!" %d"(a); x ~= a; }
end_num = max(x[0], 3);
start_num = max(x[1], 3);
if (start_num > end_num) swap(start_num, end_num);
start_num = start_num | 1; // if start_num even add
1
e
On Monday, 9 September 2024 at 19:29:01 UTC, Salih Dincer wrote:
My only concern is why i == 5 in the line below when i == 28?
i isn't being modified by a `*=`. its only the two ++
On Monday, 9 September 2024 at 17:56:04 UTC, monkyyy wrote:
auto parse(char[] s)=>s[9..$-2];
void show(T,string file= __FILE__,int line=__LINE__)(T t){
writeln(File(file).byLine.drop(line-1).front.parse," ==
",t);
}
void main(){
int i=3;
show(i++ + ++i * i);
show(i);
}
This so
On Monday, 9 September 2024 at 17:39:46 UTC, WraithGlade wrote:
import std;
auto parse(char[] s)=>s[9..$-2];
void show(T,string file= __FILE__,int line=__LINE__)(T t){
writeln(File(file).byLine.drop(line-1).front.parse," == ",t);
}
void main(){
int i=3;
show(i++ + ++i * i);
sho
Thank you all for your very helpful replies and for taking the
time to make them!
It is indeed heartening to see that D supports multiple different
forms of this mechanism.
This is certainly sufficient for the example I gave.
I suggest that something like this should be added to the
standar
On Sunday, 8 September 2024 at 22:01:10 UTC, WraithGlade wrote:
Basically, I want there to be a way to print both an expression
and its value but to only have to write the expression once
(which also aids refactoring). Such a feature is extremely
useful for faster print-based debugging.
[...]
17 matches
Mail list logo