<commit_before>#include "../../include/gtest/gtest.h"

// #include "subcircuit.h"
#include "unary_gate.h"
#include "binary_gate.h"

// TEST(TEST_GROUP_NAME, TEST_NAME) {
//
// }


TEST(LogicGateTest, And) {
  EXPECT_EQ(0, And(0, 0).evaluate());
  EXPECT_EQ(0, And(0, 1).evaluate());
  EXPECT_EQ(1, And(1, 1).evaluate());
  EXPECT_EQ(0, And(1, 0).evaluate());
}

TEST(LogicGateTest, Or) {
  EXPECT_EQ(0, Or(0, 0).evaluate());
  EXPECT_EQ(1, Or(0, 1).evaluate());
  EXPECT_EQ(1, Or(1, 1).evaluate());
  EXPECT_EQ(1, Or(1, 0).evaluate());
}

TEST(LogicGateTest, Not) {
  EXPECT_EQ(1, Not(0).evaluate());
  EXPECT_EQ(0, Not(1).evaluate());
}

TEST(ComboTests, NAND) {
  EXPECT_EQ(1, Not(And(0, 0).evaluate()).evaluate());
  EXPECT_EQ(1, Not(And(0, 1).evaluate()).evaluate());
  EXPECT_EQ(0, Not(And(1, 1).evaluate()).evaluate());
  EXPECT_EQ(1, Not(And(1, 0).evaluate()).evaluate());
}

TEST(ComboTests, NOR) {
  EXPECT_EQ(1, Not(Or(0, 0).evaluate()).evaluate());
  EXPECT_EQ(0, Not(Or(0, 1).evaluate()).evaluate());
  EXPECT_EQ(0, Not(Or(1, 1).evaluate()).evaluate());
  EXPECT_EQ(0, Not(Or(1, 0).evaluate()).evaluate());
}

// TEST(SubCircuitTest, AND) {
//   std::vector<Gate*> gates;
//   gates.push_back(new And(0,1));
//   SubCircuit subcircuit(gates);
//   EXPECT_EQ(0, subcircuit.evaluate());
// }

// TEST(SubCircuitTest, NOR) {
//   std::vector<Gate*> gates;
//   gates.push_back(new Not(0));
//   gates.push_back(new Or(0,1));
//   SubCircuit subcircuit(gates);
//   EXPECT_EQ(0, subcircuit.evaluate());
// }

// class SubCircuitTest : public testing::Test {
//  protected:
//   virtual void SetUp() {
//     subcircuit.insert_gate(And(0,1));
//     // subcircuit.insert_gate(Not(0));
//   }

//   SubCircuit subcircuit;
// };
<commit_msg>Added and refactored unit_tests<commit_after>#include "../../include/gtest/gtest.h"
#include "circuit.h"
#include <vector>
#include "gate.h"

// TEST(TEST_GROUP_NAME, TEST_NAME) {
//
// }
TEST(WireTest, Wire) {
    Wire wire_1 = Wire(true);
    EXPECT_EQ(1, wire_1.evaluate());
}
class WireSetup : public testing::Test {
    protected:
        virtual void SetUp() {
            wire_1 = new Wire(true);
            wire_0 = new Wire(false);
        }
        Wire* wire_1;
        Wire* wire_0;
};

TEST_F(WireSetup, And) {
  EXPECT_EQ(0, And(wire_0, wire_0).evaluate());
  EXPECT_EQ(0, And(wire_0, wire_1).evaluate());
  EXPECT_EQ(1, And(wire_1, wire_1).evaluate());
  EXPECT_EQ(0, And(wire_1, wire_0).evaluate());
}

TEST_F(WireSetup, Or) {
  EXPECT_EQ(0, Or(wire_0, wire_0).evaluate());
  EXPECT_EQ(1, Or(wire_0, wire_1).evaluate());
  EXPECT_EQ(1, Or(wire_1, wire_1).evaluate());
  EXPECT_EQ(1, Or(wire_1, wire_0).evaluate());
}

TEST_F(WireSetup, Not) {
  EXPECT_EQ(1, Not(wire_0).evaluate());
  EXPECT_EQ(0, Not(wire_1).evaluate());
}

TEST_F(WireSetup, NAND) {
  EXPECT_EQ(1, Not(new And(wire_0, wire_0)).evaluate());
  EXPECT_EQ(1, Not(new And(wire_0, wire_1)).evaluate());
  EXPECT_EQ(0, Not(new And(wire_1, wire_1)).evaluate());
  EXPECT_EQ(1, Not(new And(wire_1, wire_0)).evaluate());
}

TEST_F(WireSetup, NOR) {
  EXPECT_EQ(1, Not(new Or(wire_0, wire_0)).evaluate());
  EXPECT_EQ(0, Not(new Or(wire_0, wire_1)).evaluate());
  EXPECT_EQ(0, Not(new Or(wire_1, wire_1)).evaluate());
  EXPECT_EQ(0, Not(new Or(wire_1, wire_0)).evaluate());
}

TEST(Circuit, Simple) {
    Circuit c({true, false});
    std::vector<bool> expected_output{true, false};
    EXPECT_EQ(expected_output, c.evaluate());
}

TEST(Circuit, LessSimple) {
    Circuit c({true, false});
    c.addGate(AND, 1, 1);
    c.addGate(WIRE, 0);
    std::vector<bool> expected_output{true, true};
    EXPECT_EQ(expected_output, c.evaluate());
}

// TEST(SubCircuitTest, NOR) {
//   std::vector<Gate*> gates;
//   gates.push_back(new Not(0));
//   gates.push_back(new Or(0,1));
//   SubCircuit subcircuit(gates);
//   EXPECT_EQ(0, subcircuit.evaluate());
// }


{'fraction_non_alphanumeric': 0.21161290322580645, 'fraction_numerical': 0.03303225806451613, 'mean_word_length': 4.324175824175824, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2058643', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1570, 'n_words': 251}