github.com

I've created a small library that allows to create mock functions. You can record the calls to the function and check arguments with it. It happened to me multiple times that somebody has changed the function that was mocked and it didn't comply with the values returned by mock or the function was called differenty in the code. I recently added a support for instrumentation of mock functions with Malli schemas. If you declare a mock for a function that has Malli function schema, it will instrument the mock. This allows to discover mocks returning invalid values or accepting invalid arguments or the number of arguments. Here's an example: ```clojure (require '[malli.core :as m]) (m/=> my-inc [:=> [:cat :int] :int]) (defn my-inc [x] (inc x)) ;; You have to provide a symbol of function ;; or with or without namespace (aliases are supported). (def my-inc-mock (mock-fn 'my-inc 1)) (my-inc-mock 0) ;=> 1 (my-inc-mock "foo") ;=> An exception ::invalid-input (def my-inc-mock2 (mock-fn 'my-inc nil)) (my-inc-mock2 1) ;=> An exception ::invalid-output ``` This instrumentation works also with a macro for defining mocks. ```clojure (with-mocks [my-inc 2] (my-inc "foo")) ;=> An exception ::invalid-input (with-mocks [my-inc nil] (my-inc 1)) ;=> An exception ::invalid-output ```

3
0
AI achieves silver-medal standard solving International Mathematical Olympiad problems
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearMR
    mrroman
    3mo ago 100%

    I wonder if they are sure that similar exercises weren’t in the learning set for AI. Such competitions have usually kind of patterns for exercises and people usually learn to them by resolving a large number of exercises to catch the pattern.

    3
  • /etc/debian_version is still 12.0
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearMR
    mrroman
    1y ago 100%

    I'm using http://deb.debian.org/debian mirror, but I was surprised that it didn't download files with apt-get update command. I removed /var/lib/apt/lists directory, and it worked and upgraded to 12.1 :).

    1
  • /etc/debian_version is still 12.0
  • "Initials" by "Florian Körner", licensed under "CC0 1.0". / Remix of the original. - Created with dicebear.comInitialsFlorian Körnerhttps://github.com/dicebear/dicebearMR
    mrroman
    1y ago 100%

    I've upgraded packages several times. My base-files package has version 12.4. I've tried with apt update and apt upgrade -s and I don't have any package to upgrade. Is it possible that the version is locked somewhere?

    1
  • I have updated packages many times after 12.1 release, but I still have 12.0 in debian_version file. I tried to install today printer drivers but it couldn’t get the latest libcupsimage2 2.4.2-3 library on the server although there is 2.4.2-5 already. How to fix the version? Is it possible that it breaks cupsimage installation?

    5
    5