<commit_before>// Copyright (c) 2014 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <gtest/gtest.h>

#include "ringfile_internal.h"
#include "test_util.h"

TEST(RingfileTest, CannotOpenBogusPath) {
  std::string path = TempDir() + "/does not exist/ring";
  Ringfile ringfile;
  ASSERT_FALSE(ringfile.Create(path, 1024));
  ASSERT_EQ(ENOENT, ringfile.error());
}

TEST(RingfileTest, CanReadAndWriteBasics) {
  std::string path = TempDir() + "/ring";
<commit_msg>add missing header on Linux<commit_after>// Copyright (c) 2014 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <errno.h>
#include <gtest/gtest.h>

#include "ringfile_internal.h"
#include "test_util.h"

TEST(RingfileTest, CannotOpenBogusPath) {
  std::string path = TempDir() + "/does not exist/ring";
  Ringfile ringfile;
  ASSERT_FALSE(ringfile.Create(path, 1024));
  ASSERT_EQ(ENOENT, ringfile.error());
}

TEST(RingfileTest, CanReadAndWriteBasics) {
  std::string path = TempDir() + "/ring";

{'fraction_non_alphanumeric': 0.13449781659388646, 'fraction_numerical': 0.013973799126637555, 'mean_word_length': 4.846938775510204, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '769755', 'n_tokens_mistral': 403, 'n_tokens_neox': 380, 'n_words': 112}