Hi,
So I’ve completed the exercise ON MY MACHINE (see below )
But when I submit Exercism says there is an error:
AN ERROR OCCURRED
but no actual output so I cannot tell what is (NOT) going on…
vscode ➜ /workspaces/exercism/cpp/crypto-square $ make
[100%] Built target crypto-square
===============================================================================
All tests passed (1 assertion in 1 test case)
[100%] Built target test_crypto-square
vscode ➜ /workspaces/exercism/cpp/crypto-square $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)
sure
#if !defined(CRYPTO_SQUARE_H)
#define CRYPTO_SQUARE_H
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
namespace crypto_square
{
class cipher
{
string _cipher_text;
public:
cipher(string plain_text)
{
string t;
for (auto c : plain_text)
{
c = ::tolower(c);
if (::isalnum(c))
t.push_back(c);
};
double sr = sqrt( t.length() );
int r = round(sr);
int c = ceil(sr);
t += string(c,' ');
for (auto y = 0; y < c; y++)
{
for (auto x = 0; x < r; x++)
{
_cipher_text += t[ y + x * c ];
}
_cipher_text += y < c -1 ? " " : "";
}
}
string normalized_cipher_text()
{
return _cipher_text;
}
};
} // namespace crypto_square
#endif // CRYPTO_SQUARE_H
ahans
March 15, 2024, 12:41pm
4
The example solution gives the same error. Something is up with the test runner. I don’t know (yet) how to test that locally (including the test runner I mean). But I would first look at any logs that may be available. So if someone with the required permissions could do that, that would probably be a great first step.
IsaacG
March 15, 2024, 2:21pm
5
Are you uncommenting the skip tests and running all the tests locally? Most exercises have more than one test!
Eagle eyes!
But I had replaced the tests files with a fresh copy, thinking I had messed up the test file some how…just forgot to remove the ifdef
I’ve even set up an alpine docker container and rerun the exercism there… it build and passes…¯_(ツ)_/¯ I
I used the dockerfile from github exercism cpp runner to match the environment…
~/exercism/cpp/crypto-square # make
make
[ 25%] Building CXX object CMakeFiles/crypto-square.dir/crypto_square_test.cpp.o
[ 50%] Linking CXX executable crypto-square
[100%] Built target crypto-square
===============================================================================
All tests passed (8 assertions in 8 test cases)
[100%] Built target test_crypto-square
~/exercism/cpp/crypto-square # g++ -v
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/12.2.1/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-12-20220924/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-languages=c,c++,d,objc,go,fortran,ada --disable-libssp --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues --with-system-zlib --with-linker-hash-style=gnu --with-pkgversion='Alpine 12.2.1_git20220924-r10'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r10)
Yes, that looks definitely like something on Exercism’s side. Even a dummy solution that just returns an empty string results in that “AN ERROR OCCURRED” instead of failed tests.
@ErikSchierboom Could you take a look into the server logs, please?
Edit: done, no need to investigate any more
iHiD
March 15, 2024, 3:07pm
8
I note that tests: update crypto-square exercise by ahans · Pull Request #827 · exercism/cpp · GitHub was merged very recently.
I note “Currently, line breaks in the “name” of the exercise will break the test runner, can you keep them on one line until I fix this behavior?”
And that the resulting PR didn’t have them on one line. Maybe related?
Erik’s off atm and I don’t have time to look at logs today, sorry.
You’re right, after some digging I’m fairly sure that these line breaks cause the issue.
ahans
March 15, 2024, 4:10pm
10
I did the update of the tests and changed the line break for one test, not realizing that there was a second with the same issue. The reviewer(s) missed this also. PR is coming up to hopefully fix it. The second exercise I touched that has issues.
ahans
March 15, 2024, 4:13pm
11
ahans
March 15, 2024, 4:13pm
12
I will also look at what’s the issue with the test runner. It should be able to deal with this. Maybe this way I can make up for it …