Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 10 14:41
    Snaipe commented #336
  • Jan 10 09:11
    Bensuperpc closed #335
  • Jan 10 09:10
    Bensuperpc commented #335
  • Jan 10 07:58
    hydrapolic commented #336
  • Jan 10 06:51
    kugel- commented #336
  • Jan 10 05:56
    Snaipe commented #333
  • Jan 09 23:55
    Snaipe commented #223
  • Jan 09 23:52
    Snaipe commented #335
  • Jan 09 23:45
    hydrapolic commented #336
  • Jan 09 23:44
    hydrapolic commented #337
  • Jan 09 23:31
    Snaipe closed #337
  • Jan 09 23:29

    Snaipe on bleeding

    api: fixed zero producing warni… (compare)

  • Jan 09 23:29
    Snaipe closed #330
  • Jan 09 23:28
    Snaipe commented #333
  • Jan 09 23:25
    Snaipe commented #336
  • Jan 09 23:23

    Snaipe on bleeding

    meson: Add/fix options to not-b… (compare)

  • Jan 09 23:23
    Snaipe closed #334
  • Jan 09 23:23
    Snaipe commented #334
  • Jan 09 23:21
    Snaipe commented #337
  • Jan 09 22:26
    hydrapolic opened #337
Douman
@DoumanAsh
But what will happen if i wouldn't pass it to GetCLipboardData? As of now test works ok
also i changed mmk_when, not mmk_verify
I assumed if i would change mmk_when then mmk_verify would fail, but it works
Franklin Mathieu
@Snaipe
both are actually independent
mmk_when specifies what happens at runtime when the function gets called
mmk_verify checks whether the function was called the way you wanted
they can work together or independently
Douman
@DoumanAsh
hm... but i don't exactly get mmk_when then.. i expected that it would invoke mock only when i pass format +1 to mock, but it gets invoked anyway
is there any purpose in specifying condition?
Franklin Mathieu
@Snaipe
by condition do you mean mmk_eq(UINT, format)rather than just format?
however mmk_eq is only relevant when you use other matchers
Douman
@DoumanAsh
yes, i meant mmk_eq(UINT, format) and by format + 1 i meant mmk_eq(UINT, format + 1)
Franklin Mathieu
@Snaipe
if so, yes, there is in fact no difference in this case between the two syntaxes
Douman
@DoumanAsh
and i'm confused because it makes no difference to my mock having either mmk_eq(UINT, format) or mmk_eq(UINT, format + 1)
Franklin Mathieu
@Snaipe
for instance mmk_when(func(1, mmk_le(int, 2)), .then_return = 0) is illegal because you can't mix matchers and non-matchers, so you need to use mmk_eq(int, 1) in this case
and in your case, it doesn't make any difference because by default the mock returns a zero-ish value for unspecified parameters
so, in your case, it always returns NULL
Douman
@DoumanAsh
aha... so that's why
Franklin Mathieu
@Snaipe
if you need it to return a valid clipboard HANDLE for certain values, I would probably call GetClipboardData before creating the mock, and do something like mmk_when(GetClipboardData(42), .then_return = the_handle)
Douman
@DoumanAsh
Well, i'm testing negative paths of my functions. For positive cases i use simple tests without mocks as there is no need
Btw is it indented that without any mmk_when my test would crash, if by default all mocks return NULL ?
Franklin Mathieu
@Snaipe
sounds like a bug
Douman
@DoumanAsh
I get this assertion failure E:/Downloads/Git/c_plus_plus/lazy-winapi/build/3pp/src/Mimick/src/matcher.c:51: Assertion failed: v__ != NULL
when i jsut remove any mmk_when
Franklin Mathieu
@Snaipe
no mmk_when and 1 mmk_verify, right?
I think mmk_when does some initialization that should have been mirrored in mmk_verify
Douman
@DoumanAsh
yes
hmm... i see, but i suppose it would be better for user to specify mmk_when regardless of default return value. Just this assertion makes no sense :)
Anyway, mimick is great :) though it is impossible to read compile errors/warnings :D
Franklin Mathieu
@Snaipe
If you're using a GNU compiler, you can reduce the verbosity of compile errors with -isystem=/path/to/mimick/include
Douman
@DoumanAsh
cool, thanks for a tip
Franklin Mathieu
@Snaipe
If you're using a GNU compiler, you can reduce the verbosity of compile errors with -isystem=/path/to/mimick/include
unfortunately I don't think there's a similar trigger for MSVC :/
(also sorry if my messages appear late and/or out of order, I'm on a train)
Douman
@DoumanAsh
well i prefer gcc as MSVC is just bloatware so iti s fine :)
thanks for help, again. Good luck you on your way.
Franklin Mathieu
@Snaipe
No problem, it's the least I can do.
Yuriy Yarosh
@yuriy-yarosh

o/
cr_malloc returns NULL on MacOS, for unknown reason.

Test(uri_tests, emptySchemaShouldBeParsed) {

    URI* testURI = cr_malloc(sizeof(URI));
    cr_log_warn("%u", (uint) sizeof(URI));
    cr_log_error("%u", (uint) testURI);
    cr_assert_not_null(testURI, "URI should be allocated");
...

leads to

[WARN] 88
[ERR ] 0
[----] ~/src/.../Tests/uri_test.c:12: Assertion failed: URI should be allocated
[FAIL] uri_tests::emptySchemaShouldBeParsed: (0.00s)
[====] Synthesis: Tested: 1 | Passing: 0 | Failing: 1 | Crashing: 0
Franklin Mathieu
@Snaipe
cr_malloc is only relevant when allocating memory from outside a test that should be inherited, just use malloc from within the test
Yuriy Yarosh
@yuriy-yarosh
I don't get what "allocating memory from outside" means...
Franklin Mathieu
@Snaipe
From a report hook, basically
Tests run in their own process, cr_malloc is here to ensure that memory allocated in the parent process gets inherited in the child process
Yuriy Yarosh
@yuriy-yarosh
ah... so basically it's better to go for cr_malloc in setup teardown hooks, right ?
I'm like 1.5 hours into Criterion, so I don't really get how things actually work in here.
Franklin Mathieu
@Snaipe
setup and teardown are run in the same process as the child, so no; I'm talking about things like ReportHook(PRE_ALL) {} for instance
so, in this case, don't worry about it; just use normal malloc and free
Yuriy Yarosh
@yuriy-yarosh

Ok, I'll get into it later.

Anyway, Thank You Franklin for so fast response.

Franklin Mathieu
@Snaipe
You're welcome!
Yuriy Yarosh
@yuriy-yarosh

I'm pretty hyped about Criterion, it's dope. You've did great job.
Writing C+Swift+DPDK backend web-framework, because I can :3
Something like seastar but with a simple API like Vapor

Tried Scala-native previously - it performed not that great...

Franklin Mathieu
@Snaipe
That's awesome! There's still room for a lot of improvements, and I'm rewriting a lot of the core parts for more consistency and simplicity (like #182) for 3.0. Hopefully Criterion will improve even more in the future.