Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Googling reveals only answers to this question from the last few years and some of the projects I've looked at in github haven't had commits for a long time. Is anyone working on anything at the moment? I'm interested in contributing. Also does anything test in parallel? I'm new to Clojure but one thing it seems to be missing is a test framework as good as ScalaTest.
I think speclj is still active.
https://github.com/zenmodeler/spexec is something relatively recent and devoted to BDD.
https://github.com/cucumber/cucumber-jvm also has clojure support and there's a runnable example in the clojure directory; an extended example of its use is here: https://github.com/gphilipp/bdd-guide-clojure
Eggplant is a exciting new BDD open source library used for Clojure. You can also read about it here.
For example:
(defspec multiplying-two-numbers
(specification
{:given "a input of :a and :b"
:when "we #* :c"
:then "we expect :result"
:data {:a 3 :b 4 :result 12}}))
(defspec change-a-string-to-uppercase
(specification
{:given "a input of :a"
:when "we #clojure.string/upper-case"
:then "we expect :result"
:data {:a "hello" :result "HELLO"}}))
(defspec finding-the-max-of-two-numbers
(specification
{:expect "the #max of :a and :b"
:where {:a 2 :b 3 :expected 3}}))
"Simplicity is key"
Five keywords:
given
when
then
expect
where
https://github.com/perkss/eggplant
Focusing on data driven development and testing it via spec by example using a human readable form which maintains specification documentation as the tests grow.
The standard clojure.test will run these so compatible with any IDE and build tool.
Developers can write a quick easy to follow BDD test in a very short time.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I have working code where I get hash code of data structures with (hash data-structure) but it works in small amount of them. When I have few millions of data structures it will start giving me duplicate hashes (clash). How to get something more unique when structure of data structure is unknown?
You could always resort to md5 (or anything else, really).
(defn md5 [^String s]
(let [algorithm (MessageDigest/getInstance "MD5")
raw (.digest algorithm (.getBytes s))]
(format "%032x" (BigInteger. 1 raw))))
(defn md5-hash [s] (md5 (pr-str s)))
(md5-hash {:a [1 2 3 '(5 6 7)]})
=> "8f941424e629b876cdcb51509521870d"
also, you can use Java serialization instead of pr-str.
This library has existed for a while, and I've seen at least one alternative.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm looking to write a reporting tool. The data resides in a ~6GB postgresql database. The application is an online store/catalog application that has items and orders. The stakeholders are requesting a feature that will allow them to search for an item and give a count of all those orders in the last 2 years.
Some rows contain quantities, and units of measure, which would require multiplication of quantity and UoM for each row.
It's also possible that other reporting functions will be necessary in the future.
I have not delved much into the data analysis aspect of programming. I enjoy Clojure, so I would be thrilled to find a solution that uses Clojure, but only if Clojure offers competitive tools for my needs.
Here are some options I'm considering:
merely SQL
Clojure
core.reducers
a clojure hadoop library
Hadoop
Can anyone shed some insight into these kinds of problems for me? Are there articles that you would recommend?
Hadoop is likely overkill for this project. It seems most likely that simply using Clojure-jdbc or Korma to read the data form the database and filter/reduce it in Clojure is likely to be fine. At work we routinely work with sequences of that size, though this depends on the expected response time. You may need to do some preprocessing and caching if instantaneous responses are expected.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm looking for stacktrace libraries besides https://github.com/mmcgrana/clj-stacktrace and the default clojure.stacktrace implementation. Googling stacktrace library clojure does not yield any results. Are there any alternatives?
If you are looking for a better visual representation of exceptions, use write-exception in https://github.com/AvisoNovate/pretty
Unfortunately I could not yet figure out how to integrate such nice exceptions into my emacs/nrepl workflow (if I use the nrepl middleware, my emacs show quite ugly exceptions).
In order to use the write-exception method for pretty in nrepl/emacs the following should be added to profiles.clj via :injections.
{:user {:plugins []
:dependencies [[io.aviso/pretty "0.1.8"]]
:injections [(require 'io.aviso.repl
'clojure.repl
'clojure.main)
(alter-var-root #'clojure.main/repl-caught
(constantly ##'io.aviso.repl/pretty-pst))
(alter-var-root #'clojure.repl/pst
(constantly ##'io.aviso.repl/pretty-pst))]}}
There is another method proposed here:
:repl-options {
:nrepl-middleware [io.aviso.nrepl/pretty-middleware]
}
but i prefer the good old fashion way
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Just read Douglas R. Schmidt’s paper on the reactor pattern and I'd like to see a good example actually implemented to clear some questions up. I spent some time searching for a fully implemented example but haven't been able to find one. If someone's already implemented this and is willing to share the code that would be greatly appreciated. Or, of course, a link to an example in C++ would be great as well.
You will find working examples of the Reactor pattern implementation in the, freely available, source of the ACE framework, developed by Douglas R. Schmidt: http://www.dre.vanderbilt.edu/~schmidt/ACE.html
In his book "C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks" Douglas R. Schmidt gives detailed explanation of the implementation of the Logger example project (included in ACE), both implemented as a Reactor and Proactor if I remember correctly - but I read the book a few years ago.
Look at Boost.Asio
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I love the Ruby RSpec BDD development style. Are there any good tools for doing this with C/C++?
cspec is for C. Presumably it will work with C++. There is a list of tools for various languages on the Behavior Driven Development Wikipedia page.
It seems you can test your C code using Ruby and RSpec using swig to generate wrappers! See Ben Mabey's post here:
http://benmabey.com/2007/09/09/bdd-your-c.html
I've tried that example out and it worked for me. I'm not sure if anyone has taken it any further.
The original link (CppSpec) is dead, but it is still accessible at the Internet Archive at CppSpec.
And as #VickyChijwani already mentioned, there's a copy of the project at Github - tpuronen/cppspec
Igloo is one I'm looking forward to try some time
Since an RSpec like framework was requested, I'd like to add the recent igloo.
Though originally aiming at Context/Spec syntax, it also supports Describe/It syntax. There isn't much noise in setting the test runner and test fixtures up like in those C-based frameworks. It even feels better to look at than CppSpec. They achieve this through use of decent templating mechanics.
Try CBehave! It is an RSpec-like BDD framework that uses given/when/then macros. Example:
FEATURE(1, "strstr")
SCENARIO("The strstr finds the first occurrence of the substring in the source string")
GIVEN("A source string: [Lionel Messi is a great football player]")
char *str = "Lionel Messi is a great football player";
GIVEN_END
WHEN("we use strstr to find the first occurrence of [football]")
char *p = strstr(str, "football");
WHEN_END
THEN("We should get the string: [football player]")
SHOULD_STR_EQUAL(p, "football player");
THEN_END
SCENARIO_END
FEATURE_END